-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (26 loc) · 1.17 KB
/
Copy pathDockerfile
File metadata and controls
30 lines (26 loc) · 1.17 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
# syntax=docker/dockerfile:1
# Brushlog as a static site: build with Node, serve with unprivileged nginx on :8080.
# docker build -t brushlog . # served at /
# docker build --build-arg BASE_PATH=/brushlog/ -t brushlog . # served at /brushlog/
FROM node:26-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
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" npm run 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=dist .
FROM serve AS prebuilt
COPY --from=dist . /usr/share/nginx/html${BASE_PATH}
# Default: build from source.
FROM serve
COPY --from=build /app/dist /usr/share/nginx/html${BASE_PATH}