├── .gitignore ├── Dockerfile ├── Makefile ├── README.md ├── Vagrantfile ├── config.yaml └── start.sh /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .*.sw* 3 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node 2 | MAINTAINER Keyvan Fatehi 3 | RUN adduser --disabled-password --gecos "" sinopia && \ 4 | mkdir -p /opt/sinopia/storage 5 | WORKDIR /opt/sinopia 6 | RUN npm install js-yaml sinopia && \ 7 | chown -R sinopia:sinopia /opt/sinopia 8 | USER sinopia 9 | ADD /config.yaml /tmp/config.yaml 10 | ADD /start.sh /opt/sinopia/start.sh 11 | CMD ["/opt/sinopia/start.sh"] 12 | EXPOSE 4873 13 | VOLUME /opt/sinopia 14 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | rmi: stop-test 2 | docker rmi keyvanfatehi/sinopia 2>&1 > /dev/null 3 | 4 | build: 5 | docker build -t keyvanfatehi/sinopia:latest . 6 | 7 | start-test: stop-test build 8 | docker run -p 4873:4873 --name sinopia-test -v /home/docker/sinopia-test:/opt/sinopia/storage keyvanfatehi/sinopia:latest 9 | docker logs sinopia-test 10 | 11 | stop-test: 12 | -docker rm -f sinopia-test 2>&1 > /dev/null 13 | 14 | test: build 15 | docker run --rm -i -t keyvanfatehi/sinopia:latest 16 | 17 | shell: build 18 | docker run --rm -i -t keyvanfatehi/sinopia:latest /bin/bash 19 | 20 | logs: 21 | docker logs sinopia-test 22 | 23 | publish: 24 | docker push keyvanfatehi/sinopia:latest 25 | 26 | test: start-test 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deprecation Notice 2 | 3 | Hi everyone, this project is **no longer maintained**. 4 | 5 | Please use [verdaccio/verdaccio](https://github.com/verdaccio/verdaccio) and [its official Docker Image](https://github.com/verdaccio/verdaccio#docker) 6 | 7 | 8 | 9 | ## Sinopia (Docker Image) 10 | 11 | Sinopia is a private npm repository server 12 | 13 | ### Installing Image 14 | 15 | `docker pull keyvanfatehi/sinopia:latest` 16 | 17 | ### Creating Container 18 | 19 | `docker run --name sinopia -d -p 4873:4873 keyvanfatehi/sinopia:latest` 20 | 21 | ### Setting Registry 22 | 23 | `npm set registry http://:4873/` 24 | 25 | ### Determining Username and Password 26 | 27 | `docker logs sinopia` 28 | 29 | ### Modify configuration 30 | 31 | There are two ways to modify the configuration. 32 | 33 | To understand the difference, view the conversation here: https://github.com/keyvanfatehi/docker-sinopia/pull/10 34 | 35 | ### Original Method 36 | 37 | ``` 38 | docker stop sinopia 39 | docker run --volumes-from sinopia -it --rm ubuntu vi /opt/sinopia/config.yaml 40 | docker start sinopia 41 | ``` 42 | 43 | ### Alternative Method 44 | 45 | ``` 46 | # Save the config file 47 | curl -L https://raw.githubusercontent.com/rlidwka/sinopia/master/conf/default.yaml -o /path/to/config.yaml 48 | # Mount the config file to the exposed data volume 49 | docker run -v /path/to/config.yaml:/opt/sinopia/config.yaml --name sinopia -d -p 4873:4873 keyvanfatehi/sinopia:latest 50 | ``` 51 | 52 | Restart the container anytime you change the config. 53 | 54 | ### configure Vagrant 55 | 56 | Setting the npm registry to `http://localhost:4873` in a Dockerfile which should point to the sinopia registry locally will not work during the `docker build` process, since localhost:4873 references to the Docker container itself and not the host-machine where sinopia runs. 57 | With the Vagrant configuration one could locally spin up this Dockerfile in a vbox with the command `vagrant up` and reference this registry it in a 'target'-Dockerfile with `RUN npm set registry http://10.10.10.10:4873`. 58 | 59 | ``` 60 | # vagrant up 61 | ``` 62 | 63 | and in the Dockerfile of your application set 64 | 65 | ``` 66 | CMD npm set registry http://10.10.10.10:4873 67 | ``` 68 | 69 | [Vagrant](https://en.wikipedia.org/wiki/Vagrant_\(software\)) is open source. See install instructions for [mac](http://sourabhbajaj.com/mac-setup/Vagrant/README.html) or [\*nix](http://www.olindata.com/blog/2014/07/installing-vagrant-and-virtual-box-ubuntu-1404-lts). 70 | 71 | ### Backups 72 | 73 | `docker run --volumes-from sinopia -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /opt/sinopia` 74 | 75 | Alternatively, host path for /opt/sinopia can be determined by running: 76 | 77 | `docker inspect sinopia` 78 | 79 | ### Restore 80 | 81 | ``` 82 | docker stop sinopia 83 | docker rm sinopia 84 | docker run --name sinopia -d -p 4873:4873 keyvanfatehi/sinopia:latest 85 | docker stop sinopia 86 | docker run --volumes-from sinopia -v $(pwd):/backup ubuntu tar xvf /backup/backup.tar 87 | docker start sinopia 88 | ``` 89 | 90 | ## Links 91 | 92 | * [Sinopia on Github](https://github.com/rlidwka/sinopia) 93 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure(2) do |config| 2 | config.vm.box = "ubuntu/trusty64" 3 | 4 | config.vm.provider "virtualbox" do |v| 5 | v.customize ["modifyvm", :id, "--memory", "2048"] 6 | v.customize ["modifyvm", :id, "--cpus", "2"] 7 | end 8 | 9 | config.vm.provision "docker" do |docker| 10 | docker.pull_images "keyvanfatehi/sinopia:latest" 11 | docker.run "keyvanfatehi/sinopia", args: "-p 4873:4873" 12 | end 13 | 14 | config.vm.network "private_network", ip: "10.10.10.10" 15 | end 16 | -------------------------------------------------------------------------------- /config.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # This is the default config file. It allows all users to do anything, 3 | # so don't use it on production systems. 4 | # 5 | # Look here for more config file examples: 6 | # https://github.com/rlidwka/sinopia/tree/master/conf 7 | # 8 | 9 | # path to a directory with all packages 10 | storage: ./storage 11 | 12 | auth: 13 | htpasswd: 14 | file: ./htpasswd 15 | # Maximum amount of users allowed to register, defaults to "+inf". 16 | # You can set this to -1 to disable registration. 17 | #max_users: 1000 18 | 19 | # a list of other known repositories we can talk to 20 | uplinks: 21 | npmjs: 22 | url: https://registry.npmjs.org/ 23 | 24 | packages: 25 | '@*/*': 26 | # scoped packages 27 | access: $all 28 | publish: $authenticated 29 | 30 | '*': 31 | # allow all users (including non-authenticated users) to read and 32 | # publish all packages 33 | # 34 | # you can specify usernames/groupnames (depending on your auth plugin) 35 | # and three keywords: "$all", "$anonymous", "$authenticated" 36 | access: $all 37 | 38 | # allow all known users to publish packages 39 | # (anyone can register by default, remember?) 40 | publish: $authenticated 41 | 42 | # if package is not available locally, proxy requests to 'npmjs' registry 43 | proxy: npmjs 44 | 45 | # log settings 46 | logs: 47 | - {type: stdout, format: pretty, level: http} 48 | #- {type: file, path: sinopia.log, level: info} 49 | 50 | listen: 51 | - 0.0.0.0:4873 52 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ ! -f config.yaml ]; then 3 | cp /tmp/config.yaml /opt/sinopia/config.yaml 4 | fi 5 | cat /opt/sinopia/config.yaml 6 | node /opt/sinopia/node_modules/sinopia/bin/sinopia --config /opt/sinopia/config.yaml --------------------------------------------------------------------------------