Fork of github.com/did-method-plc/did-method-plc
1FROM node:18-alpine as build
2
3# Move files into the image and install
4WORKDIR /app
5COPY ./*.* ./
6# NOTE plc's transitive dependencies go here: if that changes, this needs to be updated.
7COPY ./packages/lib ./packages/lib
8COPY ./packages/server ./packages/server
9RUN PLC_BUILD_SHALLOW=true yarn install --frozen-lockfile > /dev/null
10RUN yarn workspaces run build --update-main-to-dist > /dev/null
11# Remove non-prod deps
12RUN yarn install --production --ignore-scripts --prefer-offline > /dev/null
13
14WORKDIR packages/server/service
15RUN yarn install --frozen-lockfile > /dev/null
16
17# Uses assets from build stage to reduce build size
18FROM node:18-alpine
19
20# RUN npm install -g yarn
21RUN apk add --update dumb-init
22
23# Avoid zombie processes, handle signal forwarding
24ENTRYPOINT ["dumb-init", "--"]
25
26WORKDIR /app/packages/server/service
27COPY --from=build /app /app
28
29EXPOSE 3000
30ENV PORT=3000
31ENV NODE_ENV=production
32
33# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#non-root-user
34USER node
35CMD ["node", "--enable-source-maps", "index.js"]
36
37LABEL org.opencontainers.image.source=https://github.com/did-method-plc/did-method-plc
38LABEL org.opencontainers.image.description="DID PLC server"
39LABEL org.opencontainers.image.licenses=MIT