-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
37 lines (29 loc) · 921 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
ARG NODE_VERSION=18.18.0
ARG NODE_VERSION_SHORT=18
FROM node:${NODE_VERSION}-bullseye-slim AS builder
# Build
WORKDIR /app
RUN apt-get update && apt-get install build-essential python3 -y
COPY . .
RUN yarn install \
&& yarn build \
&& rm -rf node_modules \
&& yarn install --production
# Runtime
FROM gcr.io/distroless/nodejs${NODE_VERSION_SHORT}-debian11
WORKDIR /app
# Add sh for healtcheck script
COPY --from=busybox:1.35.0-uclibc /bin/sh /bin/sh
# Copy build files
COPY --from=builder /app/node_modules ./node_modules/
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/docs ./docs/
COPY --from=builder /app/dist ./dist/
COPY ./healthcheck.sh /app/healthcheck.sh
# Expose port and add healthcheck
EXPOSE 5050
HEALTHCHECK CMD /bin/sh healthcheck.sh
# Add labels
LABEL org.opencontainers.image.title="ar.io - Observer Service"
# Start the server
CMD ["./dist/service.js"]