mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-06 22:40:26 -05:00
feat: docker image refactor a new internal binary run (#3475)
This commit is contained in:
parent
644938c0f3
commit
ebaaf3f681
3 changed files with 27 additions and 51 deletions
42
.npmignore
42
.npmignore
|
@ -1,42 +0,0 @@
|
|||
|
||||
## npm
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
node_modules
|
||||
verdaccio-*.tgz
|
||||
docker-compose.yaml
|
||||
Dockerfile
|
||||
crowdin.yaml
|
||||
scripts/
|
||||
src/
|
||||
/.*
|
||||
.vscode/
|
||||
.circleci/
|
||||
debug/
|
||||
docker-examples/
|
||||
reports/
|
||||
## assets and website
|
||||
assets/
|
||||
|
||||
## docs
|
||||
docs/
|
||||
wiki/
|
||||
|
||||
## flow
|
||||
flow-typed/
|
||||
types/
|
||||
|
||||
# jest
|
||||
coverage/
|
||||
test-storage*
|
||||
test/
|
||||
__mocks__/
|
||||
jestEnvironment.js
|
||||
test/jest.e2e.config.js
|
||||
test/jest.config.functional.js
|
||||
jest.config.js
|
||||
|
||||
# misc
|
||||
contrib/
|
||||
storage_default_storage/
|
||||
docker-bin/
|
35
Dockerfile
35
Dockerfile
|
@ -15,15 +15,19 @@ RUN apk --no-cache add openssl ca-certificates wget && \
|
|||
WORKDIR /opt/verdaccio-build
|
||||
COPY . .
|
||||
|
||||
## build the project and create a tarball of the project for later
|
||||
## global installation
|
||||
RUN yarn config set npmRegistryServer $VERDACCIO_BUILD_REGISTRY && \
|
||||
yarn config set enableProgressBars true && \
|
||||
yarn config set enableTelemetry false && \
|
||||
yarn config set enableGlobalCache false && \
|
||||
yarn config set enableScripts false && \
|
||||
yarn install --immutable && \
|
||||
yarn code:docker-build && \
|
||||
yarn cache clean && \
|
||||
yarn workspaces focus --production
|
||||
yarn install && \
|
||||
yarn code:docker-build
|
||||
## pack the project
|
||||
RUN yarn pack --out verdaccio.tgz \
|
||||
&& mkdir -p /opt/tarball \
|
||||
&& mv /opt/verdaccio-build/verdaccio.tgz /opt/tarball
|
||||
## clean up and reduce bundle size
|
||||
RUN rm -Rf /opt/verdaccio-build
|
||||
|
||||
FROM node:18.12.0-alpine
|
||||
LABEL maintainer="https://github.com/verdaccio/verdaccio"
|
||||
|
@ -38,16 +42,29 @@ ENV PATH=$VERDACCIO_APPDIR/docker-bin:$PATH \
|
|||
|
||||
WORKDIR $VERDACCIO_APPDIR
|
||||
|
||||
# https://github.com/Yelp/dumb-init
|
||||
RUN apk --no-cache add openssl dumb-init
|
||||
|
||||
RUN mkdir -p /verdaccio/storage /verdaccio/plugins /verdaccio/conf
|
||||
|
||||
COPY --from=builder /opt/verdaccio-build .
|
||||
COPY --from=builder /opt/tarball .
|
||||
|
||||
USER root
|
||||
# install verdaccio as a global package so is fully handled by npm
|
||||
# ensure none dependency is being missing and is prod by default
|
||||
RUN npm install -g $VERDACCIO_APPDIR/verdaccio.tgz \
|
||||
## clean up cache
|
||||
&& npm cache clean --force \
|
||||
&& rm -Rf .npm/ \
|
||||
&& rm $VERDACCIO_APPDIR/verdaccio.tgz \
|
||||
# yarn is not need it after this step
|
||||
&& rm -Rf /opt/yarn-v1.22.19/
|
||||
|
||||
ADD conf/docker.yaml /verdaccio/conf/config.yaml
|
||||
ADD docker-bin $VERDACCIO_APPDIR/docker-bin
|
||||
|
||||
RUN adduser -u $VERDACCIO_USER_UID -S -D -h $VERDACCIO_APPDIR -g "$VERDACCIO_USER_NAME user" -s /sbin/nologin $VERDACCIO_USER_NAME && \
|
||||
chmod -R +x $VERDACCIO_APPDIR/bin $VERDACCIO_APPDIR/docker-bin && \
|
||||
chmod -R +x /usr/local/lib/node_modules/verdaccio/bin/verdaccio $VERDACCIO_APPDIR/docker-bin && \
|
||||
chown -R $VERDACCIO_USER_UID:root /verdaccio/storage && \
|
||||
chmod -R g=u /verdaccio/storage /etc/passwd
|
||||
|
||||
|
@ -59,4 +76,4 @@ VOLUME /verdaccio/storage
|
|||
|
||||
ENTRYPOINT ["uid_entrypoint"]
|
||||
|
||||
CMD node -r ./.pnp.js $VERDACCIO_APPDIR/bin/verdaccio --config /verdaccio/conf/config.yaml --listen $VERDACCIO_PROTOCOL://0.0.0.0:$VERDACCIO_PORT
|
||||
CMD verdaccio --config /verdaccio/conf/config.yaml --listen $VERDACCIO_PROTOCOL://0.0.0.0:$VERDACCIO_PORT
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/verdaccio"
|
||||
},
|
||||
"files": ["./build", "./index.js", "./conf/"],
|
||||
"dependencies": {
|
||||
"@verdaccio/commons-api": "10.2.0",
|
||||
"@verdaccio/local-storage": "10.3.1",
|
||||
|
|
Loading…
Reference in a new issue