Skip to content

Commit

Permalink
Merge pull request #5754 from pypa/docker-images
Browse files Browse the repository at this point in the history
Add docker build, update docs for using docker images
  • Loading branch information
matteius authored Jul 1, 2023
2 parents 0bae654 + 4e8bcf1 commit 3b719cb
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
5 changes: 5 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ARG PYVERSION
FROM docker.io/python:${PYVERSION}

ARG VERSION
RUN pip install pipenv=="${VERSION}"
13 changes: 13 additions & 0 deletions docker/Makefile
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -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
```
5 changes: 2 additions & 3 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 3b719cb

Please sign in to comment.