-
-
Notifications
You must be signed in to change notification settings - Fork 969
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
42 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |