Merge pull request #5754 from pypa/docker-images

Add docker build, update docs for using docker images
This commit is contained in:
Matt Davis
2023-07-01 19:37:16 -04:00
committed by GitHub
4 changed files with 27 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
ARG PYVERSION
FROM docker.io/python:${PYVERSION}
ARG VERSION
RUN pip install pipenv=="${VERSION}"
+13
View File
@@ -0,0 +1,13 @@
ifneq (,$(wildcard ./.env))
include .env
export
endif
docker-build:
echo $(PYVERSION) $(PIPENV)
docker build -t $(REGISTRY)/$(ORG)/$(IMG):$(TAG) --build-arg PYVERSION=$(PYVERSION) --build-arg VERSION=$(PIPENV) -f Dockerfile .
docker-push:
docker push $(REGISTRY)/$(ORG)/$(IMG):$(TAG)
+7
View File
@@ -0,0 +1,7 @@
# Public docker images
Build with:
```
$ make docker-build docker-push TAG=3.11-alpine-v2023-6-26 PYVERSION=3.11-alpine PIPENV=2023.6.26
```
+2 -3
View File
@@ -14,9 +14,8 @@ This results in a smaller image, which can still run your application.
Here is an example `Dockerfile`, which you can use as a starting point for
doing a multistage build for your application:
FROM docker.io/python:3.9 AS builder
FROM docker.io/oz123/pipenv:3.11-v2023-6-26 AS builder
RUN pip install --user pipenv
# Tell pipenv to create venv in the current directory
ENV PIPENV_VENV_IN_PROJECT=1
@@ -37,7 +36,7 @@ doing a multistage build for your application:
RUN /usr/src/.venv/bin/python -c "import requests; print(requests.__version__)"
FROM docker.io/python:3.9 AS runtime
FROM docker.io/python:3.11 AS runtime
RUN mkdir -v /usr/src/.venv