docker devpi包管理器

dockerfile镜像构建

  1. dockerfile
FROM python:3.12.2-slim

WORKDIR /data
COPY entrypoint.sh ./
COPY sources.list /etc/apt/sources.list
COPY debian.sources /etc/apt/sources.list.d/

RUN apt-get update &&\
  apt-get install -y vim net-tools procps  nginx &&\
  pip install devpi devpi-web supervisor &&\
  chmod +x /data/entrypoint.sh

ENTRYPOINT ["/data/entrypoint.sh"]
  1. entrypoint.sh
#!/bin/bash
devpi-init --serverdir=/data/pypi
/usr/local/bin/devpi-server --host=0.0.0.0 --port=3141 --serverdir /data/pypi
  1. debian.sources
Types: deb
URIs: http://mirrors.aliyun.com/debian
Suites: bookworm bookworm-updates
Components: main non-free contrib
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Types: deb
URIs: http://mirrors.aliyun.com/debian-security
Suites: bookworm-security
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg[
  1. sources.list
deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
  1. docker build -t devpi:1.8 .

docker-compose 文件

  1. devpi.yml (映射目录自行修改)
version: "3"
services:
    devpi:
        container_name: "devpi"
        privileged: true
        image: "devpi:1.8"
        restart: always
        network_mode: host
        volumes:
            - /data/devpi/package:/data/pypi
  1. docker-compose -f devpi.yml up -d
    在这里插入图片描述

初始化devpi-server 环境

  1. 安装 devpi-client (localhost 换成自己的IP,初始化只需要一次 ,只要网络通都可以使用 pip3 install -i “http://localhost:3141/root/pypi/+simple/” jwt --trusted-host localhost )
 pip3 install  devpi-client -i https://mirrors.aliyun.com/pypi/simple/
 dev use http://localhost:3141/root/py
 # 初始密码是空直接enter
 devpi login root
 # 更换阿里云镜像源
 devpi  index root/pypi  "mirror_web_url_fmt=https://mirrors.aliyun.com/pypi/simple/{name}/" \
"mirror_url=https://mirrors.aliyun.com/pypi/simple/"
 # 然后就可以安装了
 pip3 install -i "http://localhost:3141/root/pypi/+simple/" jwt --trusted-host  localhost
  1. 效果图
    在这里插入图片描述
    3.页面图片
    在这里插入图片描述
    在这里插入图片描述

注意

  1. devpi-server 需要执行一段时间拉取索引
    在这里插入图片描述
  2. 安装python包拉取日志
    在这里插入图片描述

参考连接

  1. https://devpi.net/docs/devpi/devpi/stable/+doc/quickstart-releaseprocess.html#installing-devpi-client-and-server
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值