2022-11-28 06:20:26 +00:00
|
|
|
ARG IMAGE_HOST=python
|
2023-01-19 05:04:30 +00:00
|
|
|
ARG IMAGE_LABEL=3.11-slim-bullseye
|
2022-11-28 06:20:26 +00:00
|
|
|
|
|
|
|
FROM ${IMAGE_HOST}:${IMAGE_LABEL}
|
2022-11-09 04:05:51 +00:00
|
|
|
|
2022-12-19 11:21:04 +00:00
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
|
2022-12-05 01:31:32 +00:00
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install -y --no-install-recommends \
|
|
|
|
libpq5 \
|
2022-12-05 17:37:53 +00:00
|
|
|
libxslt1.1 \
|
2022-12-19 04:26:42 +00:00
|
|
|
nginx \
|
|
|
|
busybox \
|
2022-12-05 01:31:32 +00:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2022-11-09 04:05:51 +00:00
|
|
|
|
|
|
|
COPY requirements.txt requirements.txt
|
|
|
|
|
2022-12-05 01:31:32 +00:00
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install -y --no-install-recommends \
|
2022-12-27 18:39:18 +00:00
|
|
|
netcat \
|
2022-12-05 01:31:32 +00:00
|
|
|
gcc \
|
|
|
|
libc6-dev \
|
|
|
|
libpq-dev \
|
2022-12-05 17:37:53 +00:00
|
|
|
# Required to build lxml on arm64.
|
|
|
|
libxslt1-dev \
|
|
|
|
zlib1g-dev \
|
2022-12-06 16:49:50 +00:00
|
|
|
&& python3 -m pip install --no-cache-dir --upgrade -r requirements.txt \
|
2022-12-05 01:31:32 +00:00
|
|
|
&& apt-get purge -y --auto-remove \
|
|
|
|
gcc \
|
|
|
|
libc6-dev \
|
|
|
|
libpq-dev \
|
2022-12-05 17:37:53 +00:00
|
|
|
libxslt1-dev \
|
|
|
|
zlib1g-dev \
|
2022-12-05 01:31:32 +00:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2022-11-09 04:05:51 +00:00
|
|
|
|
2022-12-19 04:26:42 +00:00
|
|
|
RUN mkdir -p /cache
|
|
|
|
|
2023-01-02 23:32:41 +00:00
|
|
|
# Python mimetypes package is missing some common mappings
|
|
|
|
COPY docker/mime.types /etc/mime.types
|
2023-01-19 05:04:30 +00:00
|
|
|
|
|
|
|
# Configure nginx
|
|
|
|
COPY docker/nginx.conf /etc/nginx/
|
2023-01-21 00:25:43 +00:00
|
|
|
COPY docker/nginx.conf.d/* /etc/nginx/conf.d/
|
2023-01-19 05:04:30 +00:00
|
|
|
|
2022-11-09 04:05:51 +00:00
|
|
|
COPY . /takahe
|
|
|
|
|
2023-01-19 05:04:30 +00:00
|
|
|
# Sanity-test the nginx config
|
|
|
|
RUN nginx -t
|
|
|
|
|
2022-11-09 04:05:51 +00:00
|
|
|
WORKDIR /takahe
|
2022-11-19 00:24:43 +00:00
|
|
|
|
2023-01-14 19:24:15 +00:00
|
|
|
RUN TAKAHE_DATABASE_SERVER="postgres://x@example.com/x" TAKAHE_SECRET_KEY="takahe" TAKAHE_MAIN_DOMAIN="static.test" python3 manage.py collectstatic --noinput
|
2022-11-19 00:24:43 +00:00
|
|
|
|
2022-11-09 04:05:51 +00:00
|
|
|
EXPOSE 8000
|
|
|
|
|
2022-11-19 17:20:13 +00:00
|
|
|
# Set some sensible defaults
|
|
|
|
ENV GUNICORN_CMD_ARGS="--workers 8"
|
|
|
|
|
2022-12-19 04:26:42 +00:00
|
|
|
CMD ["bash", "docker/run.sh"]
|