From 635e9c070555b150907edda6913676afae9d10c2 Mon Sep 17 00:00:00 2001 From: Lukas Date: Thu, 12 Mar 2026 00:32:12 +0100 Subject: [PATCH] Add Dockerfile, nginx config, and Gitea Actions CI workflow Multi-stage Docker build produces an Nginx container serving the static SPA. The CI workflow runs pnpm check on every push and builds/pushes a Docker image on semver tags. Co-Authored-By: Claude Opus 4.6 --- .gitea/workflows/ci.yml | 42 +++++++++++++++++++++++++++++++++++++++++ Dockerfile | 19 +++++++++++++++++++ nginx.conf | 9 +++++++++ 3 files changed, 70 insertions(+) create mode 100644 .gitea/workflows/ci.yml create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..b330ead --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,42 @@ +name: CI + +on: + push: + branches: [main] + tags: ["*"] + pull_request: + branches: [main] + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - run: pnpm install --frozen-lockfile + - run: pnpm check + + build-image: + if: startsWith(github.ref, 'refs/tags/') + needs: check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Log in to Gitea registry + run: echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.bahamut.nitrix.one -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin + + - name: Build and push + run: | + IMAGE=git.bahamut.nitrix.one/dostulata/initiative + TAG=${GITHUB_REF#refs/tags/} + docker build -t $IMAGE:$TAG -t $IMAGE:latest . + docker push $IMAGE:$TAG + docker push $IMAGE:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9be0a70 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM node:22-slim AS build +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" +RUN corepack enable + +WORKDIR /app +COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ +COPY packages/domain/package.json packages/domain/ +COPY packages/application/package.json packages/application/ +COPY apps/web/package.json apps/web/ +RUN pnpm install --frozen-lockfile + +COPY . . +RUN pnpm --filter web build + +FROM nginx:alpine +COPY --from=build /app/apps/web/dist /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf +EXPOSE 80 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..f749e02 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,9 @@ +server { + listen 80; + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } +}