Skip to content

Commit

Permalink
feat: switch to debian
Browse files Browse the repository at this point in the history
  • Loading branch information
Naramsim committed Jan 7, 2025
1 parent 5757301 commit 72f960c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 27 deletions.
34 changes: 8 additions & 26 deletions Resources/docker/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,15 @@
FROM python:3.11.11-alpine3.21 AS builder
FROM python:3.10.16-bookworm

ENV PYTHONUNBUFFERED=1

RUN mkdir /code
ENV PYTHONUNBUFFERED 1
ENV DJANGO_SETTINGS_MODULE 'config.docker-compose'
WORKDIR /code

ADD requirements.txt /code/
RUN apk add --no-cache postgresql-libs libstdc++
RUN apk add --no-cache --virtual .build-deps gcc g++ musl-dev \
postgresql-dev binutils rust cargo && \
python3 -m pip install -r requirements.txt --no-cache-dir

FROM python:3.11.11-alpine3.21

ENV PYTHONUNBUFFERED=1
ENV DJANGO_SETTINGS_MODULE='config.docker-compose'

RUN mkdir /code
WORKDIR /code

COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin

RUN pip install --no-cache-dir -r requirements.txt
ADD . /code/

RUN addgroup -g 1000 -S pokeapi && \
adduser -u 1000 -S pokeapi -G pokeapi
USER pokeapi
RUN groupadd -g 1000 pokeapi && \
useradd -u 1000 -g pokeapi pokeapi

CMD ["gunicorn", "config.wsgi:application", "-c", "gunicorn.conf.py"]

EXPOSE 80
USER pokeapi
CMD gunicorn config.wsgi:application -c gunicorn.conf.py
2 changes: 1 addition & 1 deletion Resources/docker/app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- [`master`](https://github.com/PokeAPI/pokeapi/blob/master/Resources/docker/app/Dockerfile)
- [`staging`](https://github.com/PokeAPI/pokeapi/blob/staging/Resources/docker/app/Dockerfile)

> `pokeapi` uses `python:3.10-alpine` as base image.
> `pokeapi` uses `python:3.10-bookworm` as base image.
## What is PokeAPI?

Expand Down
33 changes: 33 additions & 0 deletions Resources/docker/app/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM python:3.11.11-alpine3.21 AS builder

ENV PYTHONUNBUFFERED=1

RUN mkdir /code
WORKDIR /code

ADD requirements.txt /code/
RUN apk add --no-cache postgresql-libs libstdc++
RUN apk add --no-cache --virtual .build-deps gcc g++ musl-dev \
postgresql-dev binutils rust cargo && \
python3 -m pip install -r requirements.txt --no-cache-dir

FROM python:3.11.11-alpine3.21

ENV PYTHONUNBUFFERED=1
ENV DJANGO_SETTINGS_MODULE='config.docker-compose'

RUN mkdir /code
WORKDIR /code

COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin

ADD . /code/

RUN addgroup -g 1000 -S pokeapi && \
adduser -u 1000 -S pokeapi -G pokeapi
USER pokeapi

CMD ["gunicorn", "config.wsgi:application", "-c", "gunicorn.conf.py"]

EXPOSE 80

0 comments on commit 72f960c

Please sign in to comment.