From ac03a71f2754ef4178ce5df1b39b3191cf4eb8a7 Mon Sep 17 00:00:00 2001 From: Enderson Maia Date: Tue, 7 Apr 2026 11:05:09 -0300 Subject: [PATCH 1/5] docker: stick to v1 for syntax=docker/dockerfile:1 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index aa62764..d21c556 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.7 +# syntax=docker/dockerfile:1 FROM node:22-alpine AS builder From 20183258a1489b04647997e625026d6e7954d5cb Mon Sep 17 00:00:00 2001 From: Enderson Maia Date: Tue, 7 Apr 2026 11:06:17 -0300 Subject: [PATCH 2/5] docker: use debian trixie based node --- Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d21c556..ab18de9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,11 @@ # syntax=docker/dockerfile:1 -FROM node:22-alpine AS builder +ARG DEBIAN_RELEASE_NAME=trixie + +ARG NODE_VERSION=22 +ARG NODE_IMAGE=node:${NODE_VERSION}-${DEBIAN_RELEASE_NAME}-slim + +FROM ${NODE_IMAGE} AS builder WORKDIR /app From c76cb0b695d9bcfeed3bd30e5bbd2dd5cd9e8115 Mon Sep 17 00:00:00 2001 From: Enderson Maia Date: Tue, 7 Apr 2026 11:16:29 -0300 Subject: [PATCH 3/5] docker: ARG for nginx version --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ab18de9..a704d05 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,9 @@ ARG DEBIAN_RELEASE_NAME=trixie +ARG NGINX_VERSION=1.29 +ARG NGINX_IMAGE=nginx:${NGINX_VERSION}-${DEBIAN_RELEASE_NAME} + ARG NODE_VERSION=22 ARG NODE_IMAGE=node:${NODE_VERSION}-${DEBIAN_RELEASE_NAME}-slim @@ -18,7 +21,7 @@ COPY src ./src RUN npm run build -FROM nginx:1.27-alpine AS runtime +FROM ${NGINX_IMAGE} AS runtime COPY nginx.conf /etc/nginx/conf.d/default.conf COPY env.template.js /usr/share/nginx/html/config.template.js From 5c39e8d225417edfb4539444eacdb3ad58db890c Mon Sep 17 00:00:00 2001 From: Enderson Maia Date: Tue, 7 Apr 2026 11:17:20 -0300 Subject: [PATCH 4/5] docker: add static target stage --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index a704d05..0c02284 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,9 @@ COPY src ./src RUN npm run build +FROM scratch AS static +COPY --from=builder /app/dist /app/dist + FROM ${NGINX_IMAGE} AS runtime COPY nginx.conf /etc/nginx/conf.d/default.conf From 5230b5504f123f2a61c09560bac65013f0837536 Mon Sep 17 00:00:00 2001 From: Enderson Maia Date: Tue, 7 Apr 2026 15:06:24 -0300 Subject: [PATCH 5/5] ci: release container image --- .github/workflows/release.yaml | 54 ++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..75b93ed --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,54 @@ +name: Release Container Image + +on: + pull_request: + branches: [main] + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push: + name: Build and push container image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}} + type=raw,value=latest,enable=${{ github.event_name == 'push' }} + type=raw,value=pr-${{ github.event.pull_request.number }},enable=${{ github.event_name == 'pull_request' }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 + + - name: Build and push + uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 #v7.0.0 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max