From cca5196752fa831d6cc14e4a55f0b4c3140d3cbc Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Mon, 9 May 2016 14:19:35 -0300 Subject: [PATCH] Add Dockerfile to build docker image --- Dockerfile | 16 ++++++++++++++++ README.md | 10 +++++++++- conf/docker.yaml | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 conf/docker.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..dd1626c20 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM node:6.1.0-onbuild + +RUN adduser --disabled-password --gecos "" verdaccio && \ + mkdir -p /verdaccio/storage /verdaccio/conf && \ + chown -R verdaccio.verdaccio /verdaccio + +USER verdaccio +WORKDIR /verdaccio + +ADD conf/docker.yaml /verdaccio/conf/config.yaml + +EXPOSE 4873 + +VOLUME ["/verdaccio/conf", "/verdaccio/storage"] + +CMD ["/usr/src/app/bin/sinopia", "--config", "/verdaccio/conf/config.yaml", "--listen", "0.0.0.0:4873"] diff --git a/README.md b/README.md index 972c72ae5..bc886aca5 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,15 @@ Now you can navigate to [http://localhost:4873/](http://localhost:4873/) where y ### Docker -A Sinopia docker image [is available](https://registry.hub.docker.com/u/keyvanfatehi/sinopia/) +`docker build -t verdaccio .` + +``` +docker run -it --rm --name verdaccio -p 4873:4873 \ + -v //conf:/verdaccio/conf \ + -v //storage:/verdaccio/storage \ + -v //local_storage:/verdaccio/local_storage \ + verdaccio +``` ### Chef diff --git a/conf/docker.yaml b/conf/docker.yaml new file mode 100644 index 000000000..9e6e7dbdc --- /dev/null +++ b/conf/docker.yaml @@ -0,0 +1,49 @@ +# +# This is the default config file. It allows all users to do anything, +# so don't use it on production systems. +# +# Look here for more config file examples: +# https://github.com/rlidwka/sinopia/tree/master/conf +# + +# path to a directory with all packages +storage: /verdaccio/storage + +auth: + htpasswd: + file: /verdaccio/config/htpasswd + # Maximum amount of users allowed to register, defaults to "+inf". + # You can set this to -1 to disable registration. + #max_users: 1000 + +# a list of other known repositories we can talk to +uplinks: + npmjs: + url: https://registry.npmjs.org/ + +packages: + '@*/*': + # scoped packages + access: $all + publish: $all + + '*': + # allow all users (including non-authenticated users) to read and + # publish all packages + # + # you can specify usernames/groupnames (depending on your auth plugin) + # and three keywords: "$all", "$anonymous", "$authenticated" + access: $all + + # allow all known users to publish packages + # (anyone can register by default, remember?) + publish: $all + + # if package is not available locally, proxy requests to 'npmjs' registry + proxy: npmjs + +# log settings +logs: + - {type: stdout, format: pretty, level: http} + #- {type: file, path: sinopia.log, level: info} +