-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdemo.Dockerfile
More file actions
41 lines (32 loc) · 1.32 KB
/
demo.Dockerfile
File metadata and controls
41 lines (32 loc) · 1.32 KB
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
FROM python:3.9 AS build
RUN python -m pip install --upgrade pip build
WORKDIR /opt/build-context
RUN --mount=source=.,target=/opt/build-context \
python -m build --outdir /opt/build-dist
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-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 'admin@kitware.com'
# 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"]