-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
48 lines (31 loc) · 1.5 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
41
42
43
44
45
46
47
48
FROM node:20.14.0-alpine@sha256:66c7d989b6dabba6b4305b88f40912679aebd9f387a5b16ffa76dfb9ae90b060 as base
LABEL maintainer="Michael Kriese <michael.kriese@visualon.de>" \
name="verdaccio" \
org.opencontainers.image.authors="Michael Kriese <michael.kriese@visualon.de>" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.source="https://github.com/verdaccio/verdaccio" \
org.opencontainers.image.url="https://verdaccio.org"
ENV VERDACCIO_APPDIR=/opt/verdaccio \
VERDACCIO_USER_NAME=verdaccio \
VERDACCIO_USER_UID=10001 \
VERDACCIO_PORT=4873
WORKDIR $VERDACCIO_APPDIR
# Build
FROM base as build
COPY package.json pnpm-lock.yaml ./
RUN corepack pnpm install --frozen-lockfile --prod
# Final
FROM base as final
RUN apk --no-cache add tzdata dumb-init
RUN mkdir -p /verdaccio/storage /verdaccio/plugins /verdaccio/conf
ENV PATH=$VERDACCIO_APPDIR/node_modules/.bin:$PATH \
HOME=$VERDACCIO_APPDIR
RUN addgroup -g $VERDACCIO_USER_UID $VERDACCIO_USER_NAME && \
adduser -u $VERDACCIO_USER_UID -D -h $VERDACCIO_APPDIR -G $VERDACCIO_USER_NAME -s /sbin/nologin $VERDACCIO_USER_NAME && \
chown -R $VERDACCIO_USER_UID:$VERDACCIO_USER_UID /verdaccio/storage && \
chmod -R g=u /verdaccio/storage
COPY package.json .
COPY --from=build $VERDACCIO_APPDIR/node_modules node_modules
USER $VERDACCIO_USER_UID
ENTRYPOINT [ "/usr/bin/dumb-init", "--"]
CMD $VERDACCIO_APPDIR/node_modules/.bin/verdaccio --config /verdaccio/conf/config.yml --listen http://0.0.0.0:$VERDACCIO_PORT