-
Notifications
You must be signed in to change notification settings - Fork 4
/
demo.Dockerfile
43 lines (34 loc) · 1.44 KB
/
demo.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM python:3.9-slim as build
COPY setup.py /opt/build-context/setup.py
COPY MANIFEST.in /opt/build-context/MANIFEST.in
COPY ./django_large_image/ /opt/build-context/django_large_image
WORKDIR /opt/build-context
RUN python -m pip install --upgrade pip wheel setuptools
RUN python setup.py sdist bdist_wheel
FROM ghcr.io/girder/large_image:latest as demo
RUN apt-get update && \
apt-get install --no-install-recommends --yes \
libpq-dev gcc libc6-dev \
&& \
rm -rf /var/lib/apt/lists/*
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
COPY --from=build /opt/build-context/dist/*.whl /opt/django-project/wheels/
RUN pip install --find-links https://girder.github.io/large_image_wheels \
$(ls -1 /opt/django-project/wheels/*.whl) \
gunicorn \
whitenoise \
pytest \
pytest-django \
pytest-factoryboy
COPY ./demo/ /opt/django-project
WORKDIR /opt/django-project
RUN rm -rf /opt/django-project/data && mkdir /opt/django-project/data
RUN /opt/django-project/manage.py migrate
RUN /opt/django-project/manage.py collectstatic --noinput
RUN DJANGO_SUPERUSER_PASSWORD=password /opt/django-project/manage.py createsuperuser --noinput --username 'admin' --email '[email protected]'
# Test before finishing build
RUN DJANGO_SETTINGS_MODULE=myimages.settings pytest -v
EXPOSE 8000
# ENTRYPOINT ["./manage.py", "runserver", "0.0.0.0:8000"]
ENTRYPOINT ["gunicorn", "-k", "gthread", "--threads", "8", "--bind", "0.0.0.0:8000", "myimages.wsgi"]