Skip to content

Commit fa3460d

Browse files
committed
Add frontend Dockerfile
Create a container image with the static site so we can deploy to Hetzner instead of Azure static web apps. To test: podman build . --file frontend.Dockerfile --tag coco podman run --publish 80:8080 coco And visit http://localhost
1 parent 280832e commit fa3460d

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

webtool/frontend.Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Create a container image which serves a static site
2+
3+
# Build stage 1
4+
FROM docker.io/library/gradle:8.13-jdk21 AS gradle
5+
6+
COPY gradle /home/gradle/gradle
7+
WORKDIR /home/gradle/gradle
8+
9+
RUN --mount=type=cache,target=/home/gradle/.gradle/caches gradle jsBrowserProductionLibraryDistribution
10+
11+
# Build stage 2
12+
FROM docker.io/library/node:25.1.0 AS nodejs
13+
14+
WORKDIR /app/frontend
15+
16+
# minimal layer so we can cache node_modules
17+
COPY frontend/package.json frontend/package-lock.json /app/frontend/
18+
RUN npm install
19+
20+
COPY --from=gradle /home/gradle/gradle/build/js/packages/local4local-common /app/gradle/build/js/packages/local4local-common
21+
22+
ARG VITE_BACKEND_URL=https://local4local-backend.zenmo.com
23+
ARG VITE_ANYLOGIC_CALLBACK_URL=https://local4local-backend.zenmo.com
24+
25+
# Build static site
26+
COPY frontend /app/frontend
27+
RUN ls -ahl
28+
RUN npm run build
29+
30+
# Final image
31+
FROM docker.io/pierrezemb/gostatic:latest
32+
33+
COPY --from=nodejs /app/frontend/dist /srv/http
34+
35+
EXPOSE 8080
36+
37+
CMD ["-log-level", "debug", "-fallback", "index.html", "-port", "8080"]

webtool/frontend.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
frontend/dist
2+
frontend/node_modules

0 commit comments

Comments
 (0)