-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
51 lines (41 loc) · 1.1 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
FROM node:10-alpine as base
LABEL [email protected]
LABEL org.opencontainers.image.title="Hacker news API using Prisma"
LABEL org.opencontainers.image.licenses=MIT
LABEL com.bretfisher.nodeversion=$NODE_VERSION
ENV NODE_ENV=production
ENV PORT 4000
EXPOSE 4000
WORKDIR /app
ARG PRISMA_MANAGEMENT_API_SECRET
ARG PRISMA_END_POINT
ARG NODE_ENV=production
ENV PRISMA_MANAGEMENT_API_SECRET $PRISMA_MANAGEMENT_API_SECRET
ENV NODE_ENV $NODE_ENV
ENV PRISMA_END_POINT PRISMA_END_POINT
RUN apk add --no-cache tini
RUN npm i -g prisma --silent
COPY package*.json ./
RUN npm config list
RUN npm ci \
&& npm cache clean --force
ENV PATH /app/node_modules/.bin:$PATH
# ENTRYPOINT ["/tini", "--"]
CMD ["node", "src"]
# Dev Stage
FROM base as dev
ENV NODE_ENV=development
RUN npm config list
RUN npm install --only=development \
&& npm cache clean --force
USER node
CMD ["nodemon", "src"]
# Test Stage
FROM dev as test
COPY . .
# RUN npm audit --production
# Production Stage
FROM base as prod
COPY --from=test /app /app
# HEALTHCHECK CMD curl http://127.0.0.1/ || exit 1
USER node