-
-
Notifications
You must be signed in to change notification settings - Fork 168
/
Dockerfile
56 lines (37 loc) · 1.29 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
47
48
49
50
51
52
53
54
55
56
# stage 0: set base image w/common customizations
FROM docker.io/library/node:lts-alpine AS base
# Prepare work directory
WORKDIR /voyager
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
ENV BUILD_FOSS_ONLY=true
# enable corepack & set network-timeout
RUN corepack enable &&\
pnpm config set network-timeout 300000
# stage 1: build
FROM base AS builder
# Prepare deps
RUN apk add --no-cache git
# Prepare build deps
# Copy .env conditionally https://stackoverflow.com/a/31532674/1319878
COPY package.json pnpm-lock.yaml .npmrc .en[v] ./
COPY patches ./patches
# Add APP_VERSION to .env if it doesn't already exist
RUN grep -q 'APP_VERSION=' .env || \
echo "APP_VERSION=`node -p \"require('./package.json').version\"`" >> .env
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
# Copy all source files
COPY index.html vite.config.ts manifest.json tsconfig.json compilerOptions.js ./
COPY public ./public
COPY scripts ./scripts
COPY src ./src
# Build
RUN pnpm build
# stage 2: runtime
FROM docker.io/library/nginx AS runner
ARG UID=911 GID=911
COPY scripts/docker_generate_config.sh /docker-entrypoint.d/generate_config.sh
COPY nginx.conf.template /etc/nginx/templates/default.conf.template
COPY --from=builder /voyager/dist /var/www
ENV NGINX_PORT=5314
EXPOSE 5314/tcp