0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

Merge pull request #181 from kba/better-docker-cntd

Better docker cntd
This commit is contained in:
jotadeveloper 2017-06-18 17:34:16 +02:00 committed by GitHub
commit 2cceccad55
3 changed files with 56 additions and 9 deletions

View file

@ -1,13 +1,24 @@
FROM node:6.1.0-onbuild
FROM node:6-alpine
LABEL maintainer="https://github.com/verdaccio/verdaccio"
ENV APPDIR /usr/local/app
RUN mkdir -p "$APPDIR"
WORKDIR $APPDIR
ADD . $APPDIR
RUN npm install
RUN mkdir -p /verdaccio/storage /verdaccio/conf
WORKDIR /verdaccio
ADD conf/docker.yaml /verdaccio/conf/config.yaml
RUN addgroup -S verdaccio && adduser -S -g verdaccio verdaccio && \
chown -R verdaccio:verdaccio "$APPDIR" && \
chown -R verdaccio:verdaccio /verdaccio
USER verdaccio
EXPOSE 4873
VOLUME ["/verdaccio/conf", "/verdaccio/storage"]
VOLUME ["/verdaccio"]
CMD ["/usr/src/app/bin/verdaccio", "--config", "/verdaccio/conf/config.yaml", "--listen", "0.0.0.0:4873"]
CMD ["sh", "-c", "${APPDIR}/bin/verdaccio --config /verdaccio/conf/config.yaml --listen 0.0.0.0:4873"]

View file

@ -102,16 +102,40 @@ To build the docker image for raspberry pi execute:
```bash
npm run build-docker:rpi
```
To run the docker container:
```
```bash
docker run -it --rm --name verdaccio -p 4873:4873 \
-v /<path to verdaccio directory>/conf:/verdaccio/conf \
-v /<path to verdaccio directory>/storage:/verdaccio/storage \
-v /<path to verdaccio directory>/local_storage:/verdaccio/local_storage \
verdaccio/verdaccio
```
Note: The build might take some minutes to build locally.
#### Using docker-compose
1. Get the latest version of [docker-compose](https://github.com/docker/compose).
2. Build and run the container:
```bash
$ docker-compose up --build
```
Docker will generate a named volume in which to store persistent application data. You can use `docker inspect` or `docker volume inspect` to reveal the physical location of the volume and edit the configuration, such as:
```bash
$ docker volume inspect verdaccio_verdaccio
[
{
"Name": "verdaccio_verdaccio",
"Driver": "local",
"Mountpoint": "/var/lib/docker/volumes/verdaccio_verdaccio/_data",
"Labels": null,
"Scope": "local"
}
]
```
Please note that for any of the above docker commands you need to have docker installed on your machine and the docker executable should be available on your `$PATH`.

12
docker-compose.yaml Normal file
View file

@ -0,0 +1,12 @@
version: '2'
services:
verdaccio:
build: .
container_name: verdaccio
ports:
- "4873:4873"
volumes:
- verdaccio:/verdaccio
volumes:
verdaccio:
driver: local