Skip to content

Commit

Permalink
Upgrade to Alpine 3.18 (#1575)
Browse files Browse the repository at this point in the history
Excalidraw + Diagrams.net
  • Loading branch information
ggrossetie authored Jun 14, 2023
1 parent 6a38fb8 commit f8a0d82
Show file tree
Hide file tree
Showing 8 changed files with 3,204 additions and 7,653 deletions.
51 changes: 19 additions & 32 deletions diagrams.net/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,44 +1,31 @@
# Package the Node.js project into a single binary
FROM --platform=$BUILDPLATFORM node:16.18.1-alpine3.16 as builder
FROM node:18.16-alpine3.18

# Workaround: https://github.com/nodejs/docker-node/issues/813#issuecomment-407339011
# Error: could not get uid/gid
# [ 'nobody', 0 ]
RUN npm config set unsafe-perm true
RUN addgroup -g 1001 kroki && adduser -D -G kroki -u 1001 kroki

RUN npm install -g [email protected] [email protected]
RUN apk add --quiet --no-cache --update \
chromium \
font-noto-cjk

ARG TARGETARCH
ENV NODE node16
ENV PLATFORM alpine
RUN /usr/local/bin/pkg-fetch -n $NODE -p $PLATFORM -a $([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH")

COPY package.json package-lock.json /app/
COPY src /app/src
WORKDIR /app

RUN PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 npm ci --target_arch=$([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH") --target_platform=$PLATFORM
RUN npm run lint

RUN /usr/local/bin/pkg --targets $NODE-$PLATFORM-$([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH") . -o app.bin

# Create the image
FROM alpine:3.16.3

RUN addgroup -g 1000 kroki && adduser -D -G kroki -u 1000 kroki

RUN apk add --quiet --no-cache --update chromium
USER kroki
WORKDIR /usr/local/kroki/

COPY --from=builder /app/app.bin /usr/bin/diagramsnet
COPY --chown=kroki:kroki assets /usr/local/kroki/assets
RUN mkdir -p /usr/local/kroki/node && chown kroki:kroki -R /usr/local/kroki

ENV KROKI_DIAGRAMSNET_PAGE_URL=file:///usr/local/kroki/assets/index.html
ENV KROKI_EXCALIDRAW_PAGE_URL=file:///usr/local/kroki/assets/index.html
# 15 seconds
ENV KROKI_DIAGRAMSNET_CONVERT_TIMEOUT=15000
ENV PUPPETEER_EXECUTABLE_PATH=/usr/lib/chromium/chrome
#ENV DEBUG="puppeteer:*"
ENV LEVEL="info"

COPY --chown=kroki:kroki src ./src
COPY --chown=kroki:kroki package*.json ./
COPY --chown=kroki:kroki assets ./assets

RUN npm i --omit=dev

EXPOSE 8005

USER kroki
ENTRYPOINT ["node", "src/index.js"]


ENTRYPOINT ["/usr/bin/diagramsnet"]
Loading

0 comments on commit f8a0d82

Please sign in to comment.