-
Notifications
You must be signed in to change notification settings - Fork 64
/
Dockerfile
71 lines (52 loc) · 1.87 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
FROM node:18.20-slim AS base
WORKDIR /app
# Upgrade packages
RUN apt-get -y update && \
apt-get -y upgrade && \
apt-get -y install libssl-dev
##############################
##############################
##############################
##############################
# Generate cert for local https
FROM base AS certs
WORKDIR /app/src/https
RUN apt-get -y install openssl
RUN openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 \
-subj "/C=US/ST=State/L=City/O=Organization/OU=Unit/CN=localhost" \
-passout pass:thirdweb-engine && \
chmod 600 key.pem cert.pem
##############################
##############################
##############################
##############################
FROM base AS build
# Install Python3-Pip
RUN apt-get -y install python3-pip
# Copy the entire project directory
COPY . .
# Install dependencies for both development and production (May need devDependencies to build)
# Build the project
# Prune dev dependencies from the packages
RUN yarn install --frozen-lockfile --production=false --network-timeout 1000000 && \
yarn build && \
yarn copy-files && \
yarn install --frozen-lockfile --production=true --network-timeout 1000000
##############################
##############################
##############################
##############################
FROM base AS prod
EXPOSE 3005
ARG ENGINE_VERSION
ENV ENGINE_VERSION=${ENGINE_VERSION}
ENV NODE_ENV="production" \
PATH=/app/node_modules/.bin:$PATH
COPY --from=certs /app/src/https ./dist/https
COPY --from=build /app/package.json .
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/src/prisma/* ./src/prisma/
COPY --from=build /app/dist ./dist
# Replace the schema path in the package.json file
RUN sed -i 's_"schema": "./src/prisma/schema.prisma"_"schema": "./dist/prisma/schema.prisma"_g' package.json
ENTRYPOINT [ "yarn", "start"]