Skip to content

Commit 7bd3b64

Browse files
committed
Minimal Docker Containers for Python
1 parent 71a368e commit 7bd3b64

File tree

2 files changed

+40
-12
lines changed

2 files changed

+40
-12
lines changed

Diff for: data/docker/build/index.md

+27-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## alpine
55
`nano Dockerfile`
66
```dockerfile
7-
FROM nginx:stable-alpine3.17-slim
7+
FROM alpine:3.18
88

99
RUN apk add bash
1010

@@ -28,6 +28,7 @@ COPY --chown=d_user --chmod=550 ./src /usr/share/nginx/html
2828
```
2929

3030

31+
3132
## python
3233
Debian 13: `trixie`
3334
Debian 12: `bookworm`
@@ -102,6 +103,31 @@ COPY --from=build --chown=d_user --chmod=500 /home/d_dir /home/d_python
102103
```
103104

104105

106+
## Minimal Python
107+
```dockerfile
108+
# FROM python:3.11-slim-bullseye
109+
FROM python:3.7-alpine as base
110+
111+
FROM base as builder
112+
113+
RUN mkdir /install
114+
WORKDIR /install
115+
116+
COPY requirements.txt /requirements.txt
117+
118+
RUN pip install --install-option="--prefix=/install" -r /requirements.txt
119+
120+
FROM base
121+
122+
COPY --from=builder /install /usr/local
123+
COPY src /app
124+
125+
WORKDIR /app
126+
127+
CMD ["gunicorn", "-w 4", "main:app"]
128+
```
129+
130+
105131
## build - push
106132
```bash
107133
docker image build -t asim3/my_image:latest .

Diff for: data/docker/build/othor.md

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
## Official Images
2-
[node](https://hub.docker.com/_/node)
3-
[busybox](https://hub.docker.com/_/busybox)
4-
[alpine](https://hub.docker.com/_/alpine)
5-
[django](https://hub.docker.com/_/django)
6-
[php](https://hub.docker.com/_/php)
7-
[wordpress](https://hub.docker.com/_/wordpress)
8-
[debian](https://hub.docker.com/_/debian)
9-
[python](https://hub.docker.com/_/python)
10-
[docker](https://hub.docker.com/_/docker)
11-
[httpd](https://hub.docker.com/_/httpd)
12-
[ubuntu](https://hub.docker.com/_/ubuntu)
2+
[alpine](https://hub.docker.com/_/alpine/tags)
3+
[busybox](https://hub.docker.com/_/busybox/tags)
4+
[python](https://hub.docker.com/_/python/tags)
135

146

7+
[docker](https://hub.docker.com/_/docker/tags)
8+
[debian](https://hub.docker.com/_/debian/tags)
9+
[ubuntu](https://hub.docker.com/_/ubuntu/tags)
10+
11+
12+
[node](https://hub.docker.com/_/node/tags)
13+
[httpd](https://hub.docker.com/_/httpd/tags)
14+
[php](https://hub.docker.com/_/php/tags)
15+
[wordpress](https://hub.docker.com/_/wordpress/tags)
16+
1517

1618
[Environment replacement](https://docs.docker.com/engine/reference/builder/#environment-replacement)
1719

0 commit comments

Comments
 (0)