-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
54 lines (36 loc) · 1.09 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
FROM node:14-alpine as base
WORKDIR /usr/context
RUN apk add --update --no-cache python3 alpine-sdk && ln -sf python3 /usr/bin/python
FROM base as builder-base
COPY package.json yarn.lock ./
COPY patches/ ./patches/
RUN yarn
FROM builder-base as frontend-builder
COPY vite.config.ts ./
COPY src ./src/
COPY public ./public/
COPY index.html ./
RUN yarn build
FROM builder-base as backend-builder
COPY server ./server/
RUN yarn server:build
FROM base as dependency-builder
ARG NODE_ENV="production"
ENV NODE_ENV="production"
COPY package.json yarn.lock ./
COPY patches/ ./patches/
RUN yarn
FROM node:14-alpine
WORKDIR /usr/app
ARG NODE_ENV="production"
ENV NODE_ENV="production"
COPY package.json yarn.lock ./
RUN mkdir -p /data/uploads
COPY --from=dependency-builder /usr/context/node_modules/ ./node_modules/
COPY --from=backend-builder /usr/context/server-build/ ./server-build
COPY --from=frontend-builder /usr/context/dist ./dist/
ENV DATABASE_URL="/data/database.db"
ENV STORAGE_DIRECTORY="/data"
ARG APP_VERSION="latest"
ENV APP_VERSION=$APP_VERSION
CMD [ "node", "server-build/main.js" ]