generated from acdh-oeaw/template-website-astro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.static
48 lines (30 loc) · 910 Bytes
/
Dockerfile.static
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# syntax=docker/dockerfile:1
# using alpine base image to avoid `sharp` memory leaks.
# @see https://sharp.pixelplumbing.com/install#linux-memory-allocator
# build
FROM node:20-alpine AS build
RUN corepack enable
RUN mkdir /app && chown -R node:node /app
WORKDIR /app
USER node
COPY --chown=node:node .npmrc package.json pnpm-lock.yaml ./
RUN pnpm fetch
COPY --chown=node:node ./ ./
ARG PUBLIC_APP_BASE_PATH
ARG PUBLIC_APP_BASE_URL
ARG PUBLIC_BOTS
ARG PUBLIC_GOOGLE_SITE_VERIFICATION
ARG PUBLIC_MATOMO_BASE_URL
ARG PUBLIC_MATOMO_ID
ARG PUBLIC_REDMINE_ID
# disable validation for runtime environment variables
ENV ENV_VALIDATION=public
ENV NODE_ENV=production
RUN pnpm install --frozen-lockfile --offline
RUN pnpm run build
# serve
FROM caddy:2-alpine AS serve
WORKDIR /usr/share/caddy
COPY --from=build /app/dist /usr/share/caddy
EXPOSE 3000
CMD ["caddy", "file-server", "--listen", ":3000"]