diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 602284f..b65f734 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -29,6 +29,13 @@ jobs: id: repo run: echo "owner=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT" + - name: Set version metadata + id: version_meta + run: | + echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + echo "VCS_REF=${GITHUB_SHA}" >> $GITHUB_OUTPUT + echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT + - uses: docker/setup-qemu-action@v4 - uses: docker/setup-buildx-action@v4 @@ -52,6 +59,10 @@ jobs: context: ${{ matrix.context }} file: ${{ matrix.file }} platforms: linux/amd64,linux/arm64 + build-args: | + VERSION=${{ steps.version_meta.outputs.VERSION }} + VCS_REF=${{ steps.version_meta.outputs.VCS_REF }} + BUILD_DATE=${{ steps.version_meta.outputs.BUILD_DATE }} push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/api/Dockerfile b/api/Dockerfile index b3b7672..0276fe9 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -1,4 +1,20 @@ FROM node:22-alpine + +ARG VERSION=dev +ARG VCS_REF=dev +ARG BUILD_DATE=unknown + +LABEL maintainer="Duarte Santos https://github.com/DuarteSantos8" \ + org.opencontainers.image.title="opengym-api" \ + org.opencontainers.image.description="Backend for Self-hosted gym & body-weight tracker — plan routines, log workouts (supersets & cardio too), track your weight and progress, passkey login. Your data, your server." \ + org.opencontainers.image.source="https://github.com/DuarteSantos8/openGym" \ + org.opencontainers.image.url="http://ghcr.io/duartesantos8/opengym-api" \ + org.opencontainers.image.documentation="https://github.com/DuarteSantos8/openGym#" \ + org.opencontainers.image.licenses="AGPL-3.0 license" \ + org.opencontainers.image.version=$VERSION \ + org.opencontainers.image.revision=$VCS_REF \ + org.opencontainers.image.created=$BUILD_DATE + WORKDIR /app COPY package.json package-lock.json* ./ RUN npm install --omit=dev && npm cache clean --force @@ -11,6 +27,6 @@ EXPOSE 3000 CMD ["node", "server.js"] HEALTHCHECK --interval=5m \ - --timeout=5s \ - --retries=3 \ - CMD wget --spider -q http://localhost:${PORT}/api/config \ No newline at end of file + --timeout=5s \ + --retries=3 \ + CMD wget --spider -q http://localhost:${PORT}/api/config \ No newline at end of file diff --git a/web/Dockerfile b/web/Dockerfile index aa33b8c..96ed2d0 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -15,11 +15,27 @@ COPY frontend/ ./ RUN npm run build FROM nginx:alpine + +ARG VERSION=dev +ARG VCS_REF=dev +ARG BUILD_DATE=unknown + +LABEL maintainer="Duarte Santos https://github.com/DuarteSantos8" \ + org.opencontainers.image.title="opengym-web" \ + org.opencontainers.image.description="Frontend for Self-hosted gym & body-weight tracker — plan routines, log workouts (supersets & cardio too), track your weight and progress, passkey login. Your data, your server." \ + org.opencontainers.image.source="https://github.com/DuarteSantos8/openGym" \ + org.opencontainers.image.url="http://ghcr.io/duartesantos8/opengym-web" \ + org.opencontainers.image.documentation="https://github.com/DuarteSantos8/openGym#" \ + org.opencontainers.image.licenses="AGPL-3.0 license" \ + org.opencontainers.image.version=$VERSION \ + org.opencontainers.image.revision=$VCS_REF \ + org.opencontainers.image.created=$BUILD_DATE + COPY web/nginx.conf /etc/nginx/conf.d/default.conf COPY --from=build /app/dist /usr/share/nginx/html # exercise media (img/gif) is mounted at runtime from the media volume HEALTHCHECK --interval=5m \ - --timeout=5s \ - --retries=3 \ - CMD curl -fs http://localhost/ + --timeout=5s \ + --retries=3 \ + CMD curl -fs http://localhost/ \ No newline at end of file