myheats

Live heats, scoring and leaderboard for sport events
git clone https://git.in0rdr.ch/myheats.git
Log | Files | Refs | Pull requests |Archive | README | LICENSE

commit 6c80543bb682af79c4fb2d273bf25ce10ec31940
parent 1d232d4a8bacb049140ec0b86ef0cfcc6a1613f2
Author: Andreas Gruhler <agruhl@gmx.ch>
Date:   Sat, 27 Sep 2025 19:25:42 +0200

feat(docker): build demo image with args

Diffstat:
MJenkinsfile | 14++++++++++++--
Mdockerfiles/api/Dockerfile | 4+---
Mdockerfiles/frontend/Dockerfile | 31+++++++++++++++++++------------
3 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile @@ -22,9 +22,19 @@ node('podman'){ trivy.vuln() trivy.sbom() } + // build with image context and name - buildahbud.execute([:], 'dockerfiles/api', 'myheats-api', 'latest') + buildahbud.execute([:], '.', 'myheats-api', 'latest', 'dockerfiles/api/Dockerfile') buildahpush.execute('myheats-api', 'latest') - buildahbud.execute([:], 'dockerfiles/frontend', 'myheats-frontend', 'latest') + + buildahbud.execute([ + VITE_API_URI: "https://myheats-demo.p0c.ch", + VITE_API_PORT: 443, + VITE_APP_DOC_TITLE: "MyHeats Demo", + VITE_SESSION_TTL: 259200, // 72h + VITE_WS_URI: "wss://myheats-demo.p0c.ch", + VITE_WS_PORT: 443, + VITE_LOCALE: "de-CH" + ], '.', 'myheats-frontend', 'latest', 'dockerfiles/frontend/Dockerfile') buildahpush.execute('myheats-frontend', 'latest') } diff --git a/dockerfiles/api/Dockerfile b/dockerfiles/api/Dockerfile @@ -1,9 +1,7 @@ FROM docker.io/node:18-alpine -RUN apk update && apk add --no-cache git - WORKDIR /app -RUN git clone --depth 1 https://git.in0rdr.ch/myheats.git /app +COPY . /app RUN npm ci diff --git a/dockerfiles/frontend/Dockerfile b/dockerfiles/frontend/Dockerfile @@ -1,37 +1,44 @@ FROM docker.io/node:18-alpine AS builder -# use NODE_ENV=prod to exclude the `devDependencies` (e..g, vite) -# we require `vite` command in `npm run build` below +# Use NODE_ENV=prod to exclude the `devDependencies` (e..g, vite) +# We require `vite` command in `npm run build` below ARG NODE_ENV=dev # Read args from build command ARG VITE_APP_DOC_TITLE='My Heats' +ARG VITE_API_URI='http://127.0.0.1' +ARG VITE_API_PORT=8000 +ARG VITE_SESSION_TTL=3600 +ARG VITE_WS_URI='ws://127.0.0.1' +ARG VITE_WS_PORT=8000 +ARG VITE_LOCALE='en-US' # Configure the env with the args ENV NODE_ENV="$NODE_ENV" ENV VITE_APP_DOC_TITLE="$VITE_APP_DOC_TITLE" - -RUN apk update && apk add --no-cache git +ENV VITE_API_URI="$VITE_API_URI" +ENV VITE_API_PORT="$VITE_API_PORT" +ENV VITE_SESSION_TTL="$VITE_SESSION_TTL" +ENV VITE_WS_URI="$VITE_WS_URI" +ENV VITE_WS_PORT="$VITE_WS_PORT" +ENV VITE_LOCALE="$VITE_LOCALE" WORKDIR /app -RUN git clone --depth 1 https://git.in0rdr.ch/myheats.git /app +COPY . /app -# install npm dependencies to node_modules +# Install npm dependencies to node_modules # https://docs.npmjs.com/cli/v10/commands/npm-ci RUN npm ci - -# vite static build (for production) -# https://vitejs.dev/guide/build RUN npm run build FROM docker.io/nginx:alpine -# install the static files +# Install the static files RUN rm -rf /usr/share/nginx/html/* COPY --from=builder /app/dist/ /usr/share/nginx/html/ -# install config file +# Install config file RUN rm -rf /etc/nginx/conf.d/* -COPY myheats.conf /etc/nginx/conf.d/ +COPY dockerfiles/frontend/myheats.conf /etc/nginx/conf.d/ CMD ["nginx", "-g", "daemon off;"]