Skip to content

Commit c49b5bb

Browse files
authored
Merge pull request #1177 from PokeAPI/deps
Fix building arm6/7 docker image and reduce Docker image size
2 parents b809322 + cf62b20 commit c49b5bb

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

Resources/docker/app/Dockerfile

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
1-
FROM python:3.10-alpine
1+
FROM python:3.10.16-alpine3.21 AS builder
22

3-
ENV PYTHONUNBUFFERED 1
4-
ENV DJANGO_SETTINGS_MODULE 'config.docker-compose'
3+
ENV PYTHONUNBUFFERED=1
54

65
RUN mkdir /code
76
WORKDIR /code
87

98
ADD requirements.txt /code/
109
RUN apk add --no-cache postgresql-libs libstdc++
1110
RUN apk add --no-cache --virtual .build-deps gcc g++ musl-dev \
12-
postgresql-dev rust cargo && \
13-
python3 -m pip install -r requirements.txt --no-cache-dir && \
14-
apk --purge del .build-deps
11+
postgresql-dev binutils rust cargo && \
12+
python3 -m pip install -r requirements.txt --no-cache-dir
13+
14+
FROM python:3.10.16-alpine3.21
15+
16+
ENV PYTHONUNBUFFERED=1
17+
ENV DJANGO_SETTINGS_MODULE='config.docker-compose'
18+
19+
RUN mkdir /code
20+
WORKDIR /code
21+
22+
COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
23+
COPY --from=builder /usr/local/bin /usr/local/bin
24+
1525
ADD . /code/
1626

1727
RUN addgroup -g 1000 -S pokeapi && \
1828
adduser -u 1000 -S pokeapi -G pokeapi
19-
2029
USER pokeapi
21-
CMD gunicorn config.wsgi:application -c gunicorn.conf.py
30+
31+
CMD ["gunicorn", "config.wsgi:application", "-c", "gunicorn.conf.py"]
32+
2233
EXPOSE 80

Resources/k8s/kustomize/base/other/ingress.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ kind: Ingress
33
metadata:
44
name: pokeapi-ingress
55
annotations:
6-
kubernetes.io/ingress.class: "haproxy"
76
ingress.kubernetes.io/config-backend: |
87
compression algo gzip
98
compression type application/json
@@ -13,6 +12,7 @@ spec:
1312
name: default-backend
1413
port:
1514
number: 8080
15+
ingressClassName: haproxy
1616
rules:
1717
- http:
1818
paths:
@@ -29,7 +29,6 @@ kind: Ingress
2929
metadata:
3030
name: graphql-ingress
3131
annotations:
32-
kubernetes.io/ingress.class: "haproxy"
3332
ingress.kubernetes.io/config-backend: |
3433
http-request replace-path /graphql(.*) \1
3534
spec:
@@ -38,6 +37,7 @@ spec:
3837
name: default-backend
3938
port:
4039
number: 8080
40+
ingressClassName: haproxy
4141
rules:
4242
- http:
4343
paths:

requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
Django==3.2.23
1+
Django==3.2.25
22
Unipath==1.1
33
coverage==4.5.4
44
django-cors-headers==3.14.0
55
django-discover-runner==1.0
66
django-redis==4.12.1
7-
django-cachalot==2.4.2
7+
django-cachalot==2.4.5
88
djangorestframework==3.14.0
9-
gunicorn==21.2.0
9+
gunicorn==23.0.0
1010
mimeparse==0.1.3
11-
psycopg2-binary==2.9.9
11+
psycopg2-binary==2.9.10
1212
python-dateutil==2.8.2
1313
python-mimeparse==1.6.0
1414
drf-spectacular==0.27.2

test-requirements.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
-r requirements.txt
2-
pylint===2.8.2
3-
pylint-django===2.4.4
4-
astroid==2.5.6
5-
black==23.11.0
2+
black==23.12.1

0 commit comments

Comments
 (0)