-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
73 lines (56 loc) · 1.63 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# syntax=docker/dockerfile:1.9
# Based off https://hynek.me/articles/docker-uv/
FROM python:3.12-slim AS build
SHELL ["sh", "-exc"]
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
gcc \
libffi-dev \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
ENV UV_LINK_MODE=copy \
UV_COMPILE_BYTECODE=1 \
UV_PYTHON_DOWNLOADS=never \
UV_PYTHON=python3.12 \
UV_PROJECT_ENVIRONMENT=/app
COPY pyproject.toml /src/
COPY uv.lock /src/
RUN --mount=type=cache,target=/root/.cache <<EOT
cd /src
uv sync \
--all-extras \
--locked \
--no-dev \
--no-install-project
EOT
COPY . /src
RUN --mount=type=cache,target=/root/.cache \
uv pip install \
--python=$UV_PROJECT_ENVIRONMENT \
--no-deps \
/src
#########################################################################
FROM python:3.12-slim
LABEL org.opencontainers.image.source=https://github.com/tsenoner/protspace
LABEL org.opencontainers.image.licenses=GPL-3.0
SHELL ["sh", "-exc"]
WORKDIR /app
ENV PATH=/app/bin:$PATH
# Don't run your app as root.
RUN <<EOT
groupadd -r app
useradd -r -d /app -g app -N app
EOT
# See <https://hynek.me/articles/docker-signals/>.
STOPSIGNAL SIGINT
COPY --from=build --chown=app:app /app /app
COPY data/Pla2g2/Pla2g2_pdb.zip /app/data/Pla2g2/Pla2g2_pdb.zip
COPY data/Pla2g2/protspace_files/Pla2g2_customized.json /app/data/Pla2g2/protspace_files/Pla2g2_customized.json
RUN <<EOT
python -V
python -Im site
python -Ic 'import protspace'
EOT
EXPOSE 8000
CMD ["gunicorn", "protspace.wsgi:server", "--bind", "0.0.0.0:8000"]