-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
36 lines (26 loc) · 1.15 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
# Build with: docker build -t IMAGE_NAME .
# Run with: docker run -p 3000:3000 --rm -d -e PUBLIC_POCKETBASE_URL=https://pb.haume.nz --name IMAGE_NAME IMAGE_NAME
FROM node:current-alpine AS builder
WORKDIR /staging
COPY . /staging/
RUN corepack enable && \
pnpm install --frozen-lockfile && \
pnpm build && \
pnpm prune --prod
FROM node:current-alpine
WORKDIR /app
COPY --from=builder /staging/package.json /staging/pnpm-lock.yaml /app/
COPY --from=builder /staging/node_modules /app/node_modules
COPY --from=builder /staging/build /app/build
EXPOSE 3000
CMD ["node", "/app/build/index.js"]
# how to set env variable for build without .env
# ENV PUBLIC_POCKETBASE_URL=https://pb.haume.nz
# if all dependencies in package.json are dev, you can omit node_modules, but it's tiny so don't bother.
# needed if you want to use a .env file (instead of setting env variables in CapRover etc.)
# CMD ["node", "-r", "dotenv/config", "/app/build/index.js"]
# ARG TZ=Pacific/Auckland
# RUN apk --no-cache add curl tzdata && \
# cp /usr/share/zoneinfo/$TZ /etc/localtime && \
# echo $TZ > /etc/timezone
# ENV PORT 80 # Node port inside container (3000 default)