Sign inSign up

blackbotcommunity/devpi-server

By blackbotcommunity

•Updated about 2 years ago

Actual DevPi Server for Store Your own Python Packages (+ mirror to PyPi)

Image
Integration & delivery
Databases & storage
1

372

blackbotcommunity/devpi-server repository overview

⁠Devpi Server Docker Image

This repository contains a Docker image for running a Devpi⁠ server, which is a Python package server and packaging/testing/release tool.

⁠Features

  • Based on the official Python 3.9 slim image.
  • Installs devpi-server and devpi-web.
  • Configures a default server directory.
  • Initializes and starts the Devpi server with custom entrypoint script.

⁠Usage

⁠Running the Container

To run the container, use the following command:

docker run -d -p 3141:3141 --name devpi-server blackbotcommunity/devpi-server:latest

This will start the Devpi server and expose it on port 3141.

Now you can open in your browser: http://localhost:3141⁠

⁠Environment Variables
  • DEVPI_ROOT_PASSWORD: The password for the root user (default: root).
  • DEVPI_ROOT_USERS: Users that can create/update/delete indexes and users (default: root). Separate with commas.
⁠Volumes

To persist the Devpi server data, you can mount a volume to /srv/devpi:

docker run -d -p 3141:3141 -v /path/to/data:/srv/devpi --name devpi-server blackbotcommunity/devpi-server:latest
⁠Custom Entrypoint

The image uses a custom entrypoint script docker-entrypoint.sh which:

  1. Sets default environment variables.
  2. Initializes the Devpi server if it hasn't been initialized.
  3. Starts the Devpi server.

⁠Dockerfile

The Dockerfile is based on the official Python 3.9 slim image and installs necessary dependencies and the Devpi server.

FROM python:3.9-slim

RUN <<EOF
apt-get update
apt-get install -y build-essential
rm -rf /var/lib/apt/lists/*
EOF

RUN pip install devpi-server devpi-web

RUN mkdir -p /srv/devpi

WORKDIR /srv/devpi

COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh

RUN chmod +x /usr/local/bin/docker-entrypoint.sh

ENV DEVPI_ROOT_PASSWORD=root \
    DEVPI_ROOT_USERS=root

EXPOSE 3141

CMD ["docker-entrypoint.sh", "devpi"]

⁠Entrypoint Script

The docker-entrypoint.sh script initializes and starts the Devpi server.

#!/bin/bash

set -e

function defaults {
    export DEVPISERVER_SERVERDIR=/srv/devpi
    echo "[INFO]: Setting default server directory to ${DEVPISERVER_SERVERDIR}"
}

function init_devpi {
    echo "[RUN]: Initialise devpi-server at ${DEVPISERVER_SERVERDIR}"
    devpi-init --root-passwd "${DEVPI_ROOT_PASSWORD}" --serverdir $DEVPISERVER_SERVERDIR --role master
    touch $DEVPISERVER_SERVERDIR/DEVPI_SERVER_INITIALIZED
}

function start_devpi {
    echo "[RUN]: Launching devpi-server"
    devpi-server \
        --host 0.0.0.0 \
        --port 3141 \
        --serverdir $DEVPISERVER_SERVERDIR \
        --restrict-modify "${DEVPI_ROOT_USERS}"
}

defaults

if [ "$1" = 'devpi' ]; then
    if [ ! -f $DEVPISERVER_SERVERDIR/DEVPI_SERVER_INITIALIZED ]; then
        init_devpi
    fi

    start_devpi
fi

echo "[RUN]: Builtin command not provided [devpi]"
echo "[RUN]: $@"

exec "$@"

⁠License

This project is licensed under the MIT License.

⁠About

This is the first public project by the BlackBot team.

Tag summary

Content type

Image

Digest

sha256:8c1292e22…

Size

181.3 MB

Last updated

about 2 years ago

docker pull blackbotcommunity/devpi-server