-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (35 loc) · 836 Bytes
/
Dockerfile
File metadata and controls
41 lines (35 loc) · 836 Bytes
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
# aA base stage for all future stages
# with only prod dependencies and
# no code yet
FROM node:12.17.0-alpine as base
ENV NODE_ENV=production
ENV PORT=8080
ENV PATH=/app/node_modules/.bin:$PATH
WORKDIR /app
COPY package*.json ./
COPY yarn.lock ./
COPY tsconfig.json ./
COPY tsconfig.*.json ./
COPY jest.*.js ./
COPY .eslintrc.js ./
RUN yarn install --production=true
# A dev and build-only stage. we don't need to
# copy in code since we bind-mount it
FROM base as dev
ARG NODE_ENV=development
ARG PLANET
ENV NODE_ENV=${NODE_ENV}
ENV PLANET=${PLANET}
RUN yarn install --production=false
CMD ["/app/node_modules/.bin/nodemon"]
FROM dev as build
COPY . .
RUN yarn lint
RUN yarn test
RUN yarn build
# This only has minimal deps and files
FROM base as prod
COPY --from=build /app/dist/ .
# Start
EXPOSE 8080
CMD ["node", "index.js"]