-
Notifications
You must be signed in to change notification settings - Fork 16
/
Dockerfile
59 lines (46 loc) · 1.45 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
###########################
# STEP 1: create base image
###########################
ARG NODE_VERSION=20
FROM --platform=linux/amd64 node:${NODE_VERSION}-alpine AS base
##############################
# STEP 2: install dependencies
##############################
FROM base AS dependencies
WORKDIR /usr/app
RUN yarn set version berry
# Install production packages
COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn .yarn
RUN yarn workspaces focus -A --production \
&& cp -R node_modules prod_node_modules \
&& yarn install
#####################
# STEP 3: build image
#####################
FROM dependencies AS build
WORKDIR /usr/app
COPY ./public ./public
COPY ./src ./src
COPY index.html tsconfig.json tsconfig.node.json vite.config.ts .eslintrc.cjs .prettierrc ./
ARG VITE_APP_API_ENDPOINT
ARG VITE_APP_FLODESK_API_KEY
ARG VITE_APP_AIR_TABLE_KEY
ARG VITE_APP_GIPHY_API_KEY
ARG VITE_APP_GEYSER_NOSTR_PUBKEY
ARG VITE_APP_ENV
ARG VITE_APP_AUTH_SERVICE_ENDPOINT
ARG VITE_APP_BOLTZ_SWAP_DOMAIN
RUN /bin/sh -c "printenv > .env && NODE_OPTIONS=--max-old-space-size=8192 yarn build"
RUN rm -rf ./src
###########################
# STEP 4: production image
###########################
FROM base AS production
WORKDIR /usr/app
COPY server.ts package.json yarn.lock ./
# Copy production dependencies over
COPY --from=build /usr/app/prod_node_modules ./node_modules
COPY --from=build /usr/app/dist ./dist
# RUN yarn global add serve
CMD node -r dotenv/config server.ts