-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (35 loc) · 1.11 KB
/
Dockerfile
File metadata and controls
57 lines (35 loc) · 1.11 KB
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
FROM node:18-alpine AS development
RUN apk add --no-cache \
curl \
wget \
bash \
postgresql-client
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY . .
RUN mkdir -p uploads logs
RUN chown -R node:node /app
USER node
EXPOSE 3333
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3333/health || exit 1
CMD ["yarn", "localhost"]
FROM node:18-alpine AS production
RUN apk add --no-cache curl wget bash postgresql-client
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY . .
RUN yarn build
RUN rm -rf node_modules && yarn install --frozen-lockfile --production
RUN yarn add typescript ts-node tsconfig-paths && yarn cache clean
RUN mkdir -p uploads logs
RUN addgroup -g 1001 -S nodejs && \
adduser -S node -u 1001
RUN chown -R node:nodejs /app
USER node
EXPOSE 3333
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3333/health || exit 1
CMD ["yarn", "start"]