From bb79e672bad30489eca4456b391532e9cc754fc8 Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Sun, 26 May 2024 19:14:41 -0400 Subject: [PATCH] add Dockerfile to serve build with static web server Modifications to original commit: * Add usage comment to Dockerfile Signed-off-by: Vanya A. Sergeev --- contrib/Dockerfile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 contrib/Dockerfile diff --git a/contrib/Dockerfile b/contrib/Dockerfile new file mode 100644 index 0000000..e75d293 --- /dev/null +++ b/contrib/Dockerfile @@ -0,0 +1,24 @@ +# syntax=docker/dockerfile:1 + +# From repo root directory: +# $ docker build -t briefsky -f contrib/Dockerfile . +# $ docker run -p 80:80 briefsky + +FROM node:22-alpine as build +# Ensure git is installed for baking version number +RUN apk add --no-cache git +RUN mkdir /app +WORKDIR /app +# Copy app into build container and build release +COPY . . +RUN npm install && npm run build + +FROM joseluisq/static-web-server:2-alpine +# Add curl for health check +RUN apk add --no-cache curl +# Copy built app into static webserver container +COPY --from=build /app/dist /public +# Enable /health endpoint +ENV SERVER_HEALTH=true +# Set start period for quicker start check intervals of 5s +HEALTHCHECK --start-period=30s --start-interval=5s CMD curl --fail http://localhost/health || exit 1