-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (27 loc) · 1.27 KB
/
Copy pathDockerfile
File metadata and controls
31 lines (27 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# syntax=docker/dockerfile:1
# The Multimeter web app (apps/web) as a static site: build with Node, serve with unprivileged
# nginx on :8080.
# docker build -t multimeter . # served at /
# docker build --build-arg BASE_PATH=/multimeter/ -t multimeter . # served at /multimeter/
FROM node:26-alpine AS build
WORKDIR /app
RUN npm install -g corepack && corepack enable
COPY . .
RUN pnpm install --frozen-lockfile
ARG BASE_PATH=/
# .git isn't in the build context, so pass the version in: --build-arg APP_VERSION=v1.2.0
ARG APP_VERSION=dev
RUN BASE_PATH="$BASE_PATH" APP_VERSION="$APP_VERSION" pnpm --filter web build
FROM nginxinc/nginx-unprivileged:1.29-alpine AS serve
ARG BASE_PATH=/
ENV BASE_PATH=$BASE_PATH
COPY docker/nginx.conf.template /etc/nginx/templates/default.conf.template
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO /dev/null http://127.0.0.1:8080/healthz || exit 1
# Release CI: serve a dist/ already built on the runner (.github/workflows/release.yml):
# docker buildx build --target prebuilt --build-context dist=apps/web/dist .
FROM serve AS prebuilt
COPY --from=dist . /usr/share/nginx/html${BASE_PATH}
# Default: build from source.
FROM serve
COPY --from=build /app/apps/web/dist /usr/share/nginx/html${BASE_PATH}