-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
38 lines (24 loc) · 902 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
# Base required for most things
FROM node:18-buster-slim as base
WORKDIR /opt/app
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential python dumb-init && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["dumb-init", "--"]
# Development, used for development only (defaults to watch command)
FROM base as development
CMD [ "yarn", "run", "docker:watch" ]
# Build stage for production
FROM base as build
COPY ./package.json yarn.json /opt/app/
RUN yarn
COPY . /opt/app
RUN yarn tsc
# Production image used to run the bot in production, only contains node_modules & dist contents.
FROM base as production
ENV NODE_ENV production
COPY --from=build /opt/app/dist /opt/app/dist
COPY --from=build /opt/app/node_modules /opt/app/node_modules
COPY --from=build /opt/app/package.json /opt/app/package.json
CMD [ "yarn", "run", "docker:start"]