-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
35 lines (25 loc) · 838 Bytes
/
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
FROM node:20-alpine
WORKDIR /usr/app
# Install package-manager
# use corepack for easier installation
RUN corepack enable pnpm
# Download dependencies from lockfile
# it's make build(local) faster because if there is no change in dependencies, it will use cache,
# but with `package.json` It's updated frequently, so often it won't cache.)
# See more: https://pnpm.io/cli/fetch
COPY ./pnpm-lock.yaml ./
RUN pnpm fetch
# Install dependencies
COPY ./package.json ./
RUN pnpm i --offline
# https://stackoverflow.com/questions/67639482/docker-eacces-permission-denied-mkdir-app-node-modules-cache
RUN mkdir -p ./node_modules/.cache && chmod -R 777 ./node_modules/.cache
# RUN chown -R node /app/node_modules
# Build
COPY ./ ./
# RUN pnpm build
# Clean up devDependencies
# RUN pnpm prune
EXPOSE 3000
USER node
CMD ["pnpm", "start"]