Purpose: Hosting in-house deb packages, not designed to fulfill the role of a full repository.
1.2K
Debian package repository.
$ git clone [email protected]:iomoss/docker-files.git
$ cd docker-files/reprepro
$ ./create-image.sh
Access to the repository requires affiliation with IOMOSS.
$ git clone [email protected]:iomoss/docker-files.git
$ cd docker-files/reprepro
$ ./run.sh /home/skeen/reprepro 8080 2222
Access to the repository requires affiliation with IOMOSS.
Assuming the configuration is done, you can start the server as;
$ export CONFIG_FOLDER=/home/config_here
$ export WEBSERVER_PORT=8080
$ export SSH_PORT=2222
$ docker run -v $CONFIG_FOLDER:/srv/ -p $WEBSERVER_PORT:80 -p $SSH_PORT:22 -d iomoss/reprepro
There are three ways to configurate the image;
Stand-alone (Interactive configuration);
$ export CONFIG_FOLDER=/home/config_here
$ export WEBSERVER_PORT=8080
$ export SSH_PORT=2222
$ docker run -v $CONFIG_FOLDER:/srv/ -p $WEBSERVER_PORT:80 -p $SSH_PORT:22 -it iomoss/reprepro
Stand-alone (Environemental configuration);
$ export CONFIG_FOLDER=/home/config_here
$ export WEBSERVER_PORT=8080
$ export SSH_PORT=2222
$ export KEY_REAL_NAME="{{YOUR-NAME}}"
$ export KEY_COMMENT="{{GPG-KEY COMMENT}}"
$ export KEY_EMAIL="{{YOUR-EMAIL}}"
$ export HOSTNAME="{{YOUR-DOMAIN-NAME}}"
$ export PROJECT_NAME="{{NAME-OF-APT-REPO}}"
$ export CODE_NAME="{{CODENAME-OF-OS-RELEASE}}"
$ docker run -v $CONFIG_FOLDER:/srv/ -p $WEBSERVER_PORT:80 -p $SSH_PORT:22 \
-e KEY_REAL_NAME=$KEY_REAL_NAME -e KEY_COMMENT=$KEY_COMMENT \
-e KEY_EMAIL=$KEY_EMAIL -e HOSTNAME=$HOSTNAME \
-e PROJECT_NAME=$PROJECT_NAME -e CODE_NAME=$CODE_NAME \
-it iomoss/reprepro
Stand-alone (Manual); The same as 'Configuration done'
$CONFIG_FOLDER: The folder in which the reprepro configuration is stored.$WEBSERVER_PORT: The exposed nginx port (where packages are served).$SSH_PORT: The exposed openssh-port (which is used for uploading packages).Note: Running in interactive configuration mode will prompth the user for this information.
Note: For manual configuration see the bottom of this file.
$KEY_REAL_NAME: The name to be used on the GPG keys
$KEY_COMMENT: The comment to be used on the GPG keys
$KEY_EMAIL: The email to be used on the GPG keys
$HOSTNAME: The hostname of the server (i.e. the url on which it's reached).
$PROJECT_NAME: The name of the apt repository (can be anything).
$CODE_NAME: The code-name of the os release for which packages will be served (wheezy/jessie/ect).
While most of the configuration can be done inside the container.
The authorized_keys file (for uploading packages) must be supplied from outside the container.
authorized_keysThe keys are required for adding packages to the system, and should be added to;
$CONFIG_FOLDER/home/debian/.ssh/authorized_keys
Assuming you have generated a ssh key-set on the machine, you can do this by running;
$ export CONFIG_FOLDER=/home/config_here
$ cp ~/.ssh/id_rsa.pub $CONFIG_FOLDER/home/debian/.ssh/authorized_keys
Generating a ssh key-set can be done by running;
$ ssh-keygen
And following the instructions.
Note: The image is able to run without authorized_keys being in place,
however uploading packages will not be an option then.
The below assumes that you are in the folder of your .deb package.
The example is based upon uploading kicad*.deb (multiple packages).
$ export SSH_PORT=2222
$ export HOSTNAME="{{YOUR-DOMAIN-NAME}}"
$ export CODE_NAME="{{CODENAME-OF-OS-RELEASE}}"
$ scp -P SSH_PORT kicad*.deb debian@$HOSTNAME:
$ ssh -p SSH_PORT debian@$HOSTNAME "sudo chmod -R 777 /var/www/repos/"
$ ssh -p SSH_PORT debian@$HOSTNAME "reprepro -b /var/www/repos/apt/debian includedeb $CODE_NAME *.deb"
Once the repository is up and running, clients will need to be configured to use it.
The nginx webserver (which hosts the repository) has an index page with configuration information.
Assuming your hostname is $HOSTNAME head over to http://$HOSTNAME/, and these two commands will be shown;
$ wget -O - http://$HOSTNAME/$HOSTNAME.gpg.key | apt-key add -
sources.list.d$ echo "deb http://$HOSTNAME/ $CODE_NAME main" > /etc/apt/sources.list.d/$HOSTNAME.list
At this point the repository is added, and you can run;
$ apt-get update
$ apt-get install $PACKAGE_NAME
To install $PACKAGE_NAME from your own repository to the client system.
Note: The repository is non-functional until the first package has been added.
Instead of using the interactive or environmental configuration,
you can simply provide your own configuration files inside $CONFIG_FOLDER,
alike how it was done with the authorized_keys file.
authorized_keysSee the section above.
The GPG keys are used for signing packages, they can be provided to;
$CONFIG_FOLDER/home/debian/.gnupg/pubring.pgp
$CONFIG_FOLDER/home/debian/.gnupg/secring.pgp
Generating gpg keys can be done by running;
$ gpg --gen-key
The keys will be output to ~/.gnupg/*.gpg
The nginx sites-enabled file can be provided as:
$CONFIG_FOLDER/etc/nginx/sites-enabled/reprepro-repository
The reprepro configuration file can be provided as;
$CONFIG_FOLDER/var/www/repos/apt/debian/conf/options
Content type
Image
Digest
sha256:670a5c0c1…
Size
93.6 MB
Last updated
almost 11 years ago
docker pull iomoss/reprepro