takahe/docker/Dockerfile

57 lines
1.3 KiB
Docker
Raw Normal View History

ARG IMAGE_HOST=python
2023-01-18 21:04:30 -08:00
ARG IMAGE_LABEL=3.11-slim-bullseye
FROM ${IMAGE_HOST}:${IMAGE_LABEL}
2022-11-08 20:05:51 -08:00
ENV PYTHONUNBUFFERED=1
2023-05-13 10:38:32 -07:00
COPY requirements.txt requirements.txt
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libpq5 \
libxslt1.1 \
nginx \
busybox \
netcat \
gcc \
libc6-dev \
libpq-dev \
# Required to build lxml on arm64.
libxslt1-dev \
zlib1g-dev \
2023-05-13 10:38:32 -07:00
postgresql-client \
&& python3 -m pip install --no-cache-dir --upgrade -r requirements.txt \
&& apt-get purge -y --auto-remove \
gcc \
libc6-dev \
libpq-dev \
libxslt1-dev \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
2022-11-08 20:05:51 -08:00
RUN mkdir -p /cache
# Python mimetypes package is missing some common mappings
COPY docker/mime.types /etc/mime.types
2023-01-18 21:04:30 -08:00
# Configure nginx
COPY docker/nginx.conf /etc/nginx/
COPY docker/nginx.conf.d/* /etc/nginx/conf.d/
2023-01-18 21:04:30 -08:00
2022-11-08 20:05:51 -08:00
COPY . /takahe
2023-01-18 21:04:30 -08:00
# Sanity-test the nginx config
RUN nginx -t
2022-11-08 20:05:51 -08:00
WORKDIR /takahe
2022-11-18 16:24:43 -08:00
2023-01-14 11:24:15 -08: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-18 16:24:43 -08:00
2022-11-08 20:05:51 -08:00
EXPOSE 8000
# Set some sensible defaults
ENV GUNICORN_CMD_ARGS="--workers 8"
CMD ["bash", "docker/run.sh"]