forked from Gibstick/pin-archive-3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
47 lines (29 loc) · 756 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
36
37
38
39
40
41
42
43
44
45
46
47
# syntax=docker/dockerfile:1.3
FROM node:16-bookworm-slim AS base
WORKDIR /build
# install pnpm
RUN corepack enable
RUN apt-get update && apt-get install -y dumb-init \
sqlite3 \
python3 \
make \
g++
##########
FROM base AS build
COPY pnpm-lock.yaml package.json tsconfig.json ./
COPY src ./src/
RUN pnpm fetch
RUN pnpm install --offline
RUN pnpm run build
##########
FROM base AS runner
COPY --from=build /build/dist ./dist
COPY package.json pnpm-lock.yaml ./
COPY migrations ./migrations/
RUN pnpm install --frozen-lockfile --prod
RUN mkdir -p /app/db && chown node:node /app/db
USER node
ENV PIN_ARCHIVE_DB=/app/db/pin-archive-3.sqlite3
ENV NODE_ENV=production
VOLUME /app/db
CMD ["dumb-init", "node", "./dist/main.js"]