-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
80 lines (60 loc) · 1.83 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
72
73
74
75
76
77
78
79
80
FROM node:16.13-slim AS builder
WORKDIR /app
RUN apt-get update && \
apt-get install -y \
openssl \
zip \
python3 \
python3-pip \
python3-setuptools \
groff \
less && \
pip3 install --upgrade pip && \
apt-get clean && \
pip3 --no-cache-dir install --upgrade awscli
ARG ENV
ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY
ARG AWS_DEFAULT_REGION
ARG RELEASE_NAME
ARG RESOURCES_BASE_URI
ARG DEPLOYMENT_ID
ARG SENTRY_AUTH_TOKEN
ENV ENV=$ENV
ENV AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
ENV AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
ENV AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION
ENV RESOURCES_BASE_URI=$RESOURCES_BASE_URI
ENV RELEASE_NAME=$RELEASE_NAME
ENV DEPLOYMENT_ID=$DEPLOYMENT_ID
ENV DEPLOYING=true
ENV SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN
ENV SENTRY_ORG=cubedesk
ENV SENTRY_ENVIRONMENT=$ENV
COPY package.json yarn.lock ./
RUN yarn --frozen-lockfile
COPY . .
ENV NODE_ENV=production
RUN rm -rf build && \
mkdir build && \
npx prisma generate && \
yarn deploy
RUN find ./dist -name "*.map" -type f -delete && \
find ./build -name "*.map" -type f -delete
RUN aws s3 cp dist s3://cubedesk/dist --recursive --cache-control max-age=604800 && \
aws s3 sync public s3://cubedesk/static --cache-control max-age=604800
RUN npm prune --production
RUN cp -r ./server/resources/mjml_templates ./build/server/resources/mjml_templates
RUN cp ./server/resources/not_found.html ./build/server/resources/not_found.html
RUN rm -rf ./client ./server ./shared ./test ./dist ./public && \
mv ./build/server ./server && \
mv ./build/client ./client && \
mv ./build/shared ./shared
FROM node:16.13-slim
ENV NODE_ENV=production
RUN apt-get update && \
apt-get install -y openssl
WORKDIR /app
COPY --from=builder /app /app
EXPOSE 3000
ENTRYPOINT ["node", "server/app.js"]