-
Notifications
You must be signed in to change notification settings - Fork 65
/
Dockerfile
40 lines (31 loc) · 1.02 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
ARG NODE_VERSION=20.11.1
ARG NODE_VERSION_SHORT=20
# Build
FROM node:${NODE_VERSION}-bullseye-slim AS builder
WORKDIR /app
RUN apt-get update \
&& apt-get install -y build-essential curl git python3
COPY . .
RUN yarn install \
&& yarn build \
&& rm -rf node_modules \
&& yarn install --production
# Runtime
FROM gcr.io/distroless/nodejs${NODE_VERSION_SHORT}-debian12
WORKDIR /app
# Add sh and mkdir for scripts
COPY --from=busybox:1.35.0-uclibc /bin/sh /bin/sh
COPY --from=busybox:1.35.0-uclibc /bin/mkdir /bin/mkdir
COPY --from=builder /app/node_modules ./node_modules/
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/dist/ ./dist/
COPY ./migrations /app/migrations
COPY ./docker-entrypoint.sh /app/docker-entrypoint.sh
COPY ./healthcheck.sh /app/healthcheck.sh
COPY ./docs/openapi.yaml /app/docs/openapi.yaml
VOLUME /app/data
EXPOSE 4000
HEALTHCHECK CMD /bin/sh healthcheck.sh
LABEL org.opencontainers.image.title="ar.io Core Service"
# Start
ENTRYPOINT [ "/bin/sh", "docker-entrypoint.sh" ]