forked from LuckPerms/metadata-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
41 lines (31 loc) · 815 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
39
40
41
# --------------
# BUILD STAGE
# --------------
FROM node:lts as build
WORKDIR /app
# get dependencies
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
# compile typescript
COPY tsconfig.json ./
COPY src/ ./src/
RUN npx tsc
# get production dependencies
RUN yarn install --frozen-lockfile --production
# --------------
# RUN STAGE
# --------------
FROM alpine
# get node interpreter
RUN apk add nodejs --no-cache
RUN addgroup -S app && adduser -S -G app app
USER app
WORKDIR /app
# copy compiled app files
COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/dist /app/
ENV NODE_ENV=production
HEALTHCHECK --interval=1m --timeout=5s \
CMD wget http://localhost:3000/health -q -O - | grep -c '{"status":"ok"}' || exit 1
CMD ["node", "index.js"]
EXPOSE 3000/tcp