Skip to content

Commit

Permalink
build(container): ✨ add additional tags and labels to container
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuar committed Oct 4, 2024
1 parent 3b22ee4 commit fe70940
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ concurrency:
cancel-in-progress: true

env:
COSIGN_VERSION: 'v2.4.0'
COSIGN_VERSION: "v2.4.0"
MAGEARGS: -d build/magefiles -w .

jobs:
Expand Down Expand Up @@ -52,10 +52,10 @@ jobs:
strategy:
matrix:
platform:
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
id: setup_go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5
with:
go-version-file: 'go.mod'
go-version-file: "go.mod"
- name: Install Mage
uses: magefile/mage-action@6a5dcb5fe61f43d7c08a98bc3cf9bc63c308c08e # v3
with:
Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:
run: |
gh release upload ${{ needs.check_release.outputs.release_tag }} dist/pkg/*.{rpm,deb,zst,sig}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build_container:
needs: check_release
Expand Down Expand Up @@ -193,6 +193,7 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=${{ env.APPVERSION }}
type=edge
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
- name: Set up QEMU
Expand Down
18 changes: 11 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,28 @@ RUN mage -v -d build/magefiles -w . preps:deps
RUN mage -v -d build/magefiles -w . build:full

FROM docker.io/alpine@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5
# import TARGETPLATFORM and TARGETARCH
# Add image labels.
LABEL org.opencontainers.image.source=https://github.com/joshuar/go-hass-agent
LABEL org.opencontainers.image.description=" A Home Assistant, native app for desktop/laptop devices"
LABEL org.opencontainers.image.licenses=MIT
# Import TARGETPLATFORM and TARGETARCH
ARG TARGETPLATFORM
ARG TARGETARCH
# add bash and dbus
# Add bash and dbus
RUN apk update && apk add bash dbus dbus-x11
# install run deps
# Install run deps
COPY --from=builder /usr/src/go-hass-agent/build/scripts/install-run-deps /tmp/install-run-deps
RUN /tmp/install-run-deps $TARGETPLATFORM && rm /tmp/install-run-deps
# copy binary over from builder stage
# Copy binary over from builder stage
COPY --from=builder /usr/src/go-hass-agent/dist/go-hass-agent-$TARGETARCH* /usr/bin/go-hass-agent
# allow custom uid and gid
# Allow custom uid and gid
ARG UID=1000
ARG GID=1000
# add user
# Add user
RUN addgroup --gid "${GID}" go-hass-agent && \
adduser --disabled-password --gecos "" --ingroup go-hass-agent \
--uid "${UID}" go-hass-agent
USER go-hass-agent
# set up run entrypoint/cmd
# Set up run entrypoint/cmd
ENTRYPOINT ["go-hass-agent"]
CMD ["--terminal", "run"]

0 comments on commit fe70940

Please sign in to comment.