-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile
37 lines (32 loc) · 1.07 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
# syntax=docker/dockerfile:1
ARG NODE_VERSION=18.0.0
FROM node:${NODE_VERSION}-alpine as base
WORKDIR /app
FROM base as dev
# install postgress client to debug db connection
# RUN apk --update add postgresql-client
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=cache,target=/root/.npm \
npm ci --include=dev
USER node
COPY . .
CMD npm run dev
# FROM base as prod
# ENV NODE_ENV production
# RUN --mount=type=bind,source=package.json,target=package.json \
# --mount=type=bind,source=package-lock.json,target=package-lock.json \
# --mount=type=cache,target=/root/.npm \
# npm ci --omit=dev
# USER node
# COPY . .
# CMD node src/index.js
# FROM base as test
# ENV NODE_ENV test
# RUN --mount=type=bind,source=package.json,target=package.json \
# --mount=type=bind,source=package-lock.json,target=package-lock.json \
# --mount=type=cache,target=/root/.npm \
# npm ci --include=dev
# USER node
# COPY . .
# RUN npm run test