-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.python
More file actions
23 lines (22 loc) · 1.04 KB
/
Dockerfile.python
File metadata and controls
23 lines (22 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# syntax=docker/dockerfile:1.7-labs
FROM python:3.11-bullseye
ARG USERID=500
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
RUN --mount=type=cache,target=/var/cache/apt \
apt-get update && \
apt-get --no-install-recommends --no-install-suggests -y install nginx redis && \
apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/*
RUN useradd -d /code -m --uid $USERID masserstein
USER masserstein
WORKDIR /code
COPY --chown=masserstein --parents app cfg config.ini ctl patched_app.py entrypoint.sh migrations requirements.txt runlib ./
RUN --mount=type=cache,target=/tmp/cache,uid=$USERID \
rm -f cfg/config_local.yaml cfg/config_prod.yaml; \
chmod +x ./ctl && \
./ctl --venv /tmp/cache/.venv env update && \
cp -r /tmp/cache/.venv . && \
sed 's#/tmp/cache/.venv#/code/.venv#' -i .venv/bin/* .venv/pyvenv.cfg
RUN echo "SQLALCHEMY_DATABASE_URI: postgresql://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_HOST}/{POSTGRES_DB}" >> cfg/config_local.yaml
RUN echo "TOKENSERVER=172.48.10.1" >> ~/gurobi.lic
CMD ["/code/entrypoint.sh"]