-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (35 loc) · 1.54 KB
/
Dockerfile
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
# syntax=docker/dockerfile:1.7
# Args value for build
ARG NODE_VERSION=20
# -----------------------------------------------------------------------------
# This is base image with `pnpm` package manager
# -----------------------------------------------------------------------------
FROM node:${NODE_VERSION}-alpine AS builder
ENV PNPM_HOME="/pnpm" PATH="$PNPM_HOME:$PATH"
ENV ELEVENTY_PRODUCTION=true
WORKDIR /srv
RUN apk update && apk add --no-cache libc6-compat
RUN corepack enable && corepack prepare pnpm@latest-9 --activate
COPY --chown=node:node . .
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile \
--ignore-scripts && NODE_ENV=production pnpm build
# ------------------------------------------------------------------------------
# Use the slim image for a lean production container
# ------------------------------------------------------------------------------
FROM ghcr.io/static-web-server/static-web-server:2-alpine as runner
LABEL org.opencontainers.image.source="https://github.com/riipandi/v60-eleventy"
WORKDIR /public
# Copy required application packages from builder step.
COPY --from=builder /srv/_site /public
ARG SERVER_PORT=80 \
SERVER_HOST=0.0.0.0 \
SERVER_LOG_LEVEL=info \
SERVER_LOG_REMOTE_ADDRESS=true \
SERVER_CORS_ALLOW_ORIGINS="*"
ENV SERVER_PORT=$SERVER_PORT \
SERVER_HOST=$SERVER_HOST \
SERVER_LOG_LEVEL=$SERVER_LOG_LEVEL \
SERVER_LOG_REMOTE_ADDRESS=$SERVER_LOG_REMOTE_ADDRESS \
SERVER_CORS_ALLOW_ORIGINS=$SERVER_CORS_ALLOW_ORIGINS
ENV SERVER_ROOT=/public SERVER_HEALTH=true
EXPOSE 80