11FROM docker.io/drycc/base:bullseye
22
3- COPY requirements.txt /app/requirements.txt
4- COPY dev_requirements.txt /app/dev_requirements.txt
3+ RUN adduser --system \
4+ --shell /bin/bash \
5+ --disabled-password \
6+ --home /workspace \
7+ --group \
8+ drycc
9+
10+ COPY requirements.txt /workspace/requirements.txt
11+ COPY dev_requirements.txt /workspace/dev_requirements.txt
512
613ENV PGDATA="/opt/drycc/postgresql/data" \
714 PYTHON_VERSION="3.10.2" \
@@ -17,12 +24,15 @@ RUN buildDeps='gcc rustc cargo libffi-dev musl-dev openssl'; \
1724 && install-stack rabbitmq $RABBITMQ_VERSION \
1825 && install-stack postgresql $POSTGRES_VERSION \
1926 && install-stack gosu $GOSU_VERSION && . init-stack \
20- && python3 -m venv /app/.venv \
21- && source /app/.venv/bin/activate \
22- && pip3 install --disable-pip-version-check --no-cache-dir -r /app/requirements.txt \
23- && pip3 install --disable-pip-version-check --no-cache-dir -r /app/dev_requirements.txt \
27+ && python3 -m venv /workspace/.venv \
28+ && source /workspace/.venv/bin/activate \
29+ && pip3 install --disable-pip-version-check --no-cache-dir -r /workspace/requirements.txt \
30+ && pip3 install --disable-pip-version-check --no-cache-dir -r /workspace/dev_requirements.txt \
31+ && chown -R drycc:drycc /workspace \
32+ # set env
33+ && echo "source /workspace/.venv/bin/activate" >> /opt/drycc/python/profile.d/python.sh \
2434 # cleanup
25- && scanelp /app /.venv/lib > runtime.txt \
35+ && scanelp /workspace /.venv/lib > runtime.txt \
2636 && apt-get purge -y --auto-remove $buildDeps \
2737 && install-packages $(< runtime.txt) \
2838 && apt-get autoremove -y \
@@ -46,7 +56,7 @@ RUN buildDeps='gcc rustc cargo libffi-dev musl-dev openssl'; \
4656 && chown -R postgres:postgres /run/postgresql $PGDATA \
4757 && gosu postgres initdb -D $PGDATA
4858
49- COPY . /app
50- WORKDIR /app
51- CMD ["/app /bin/boot"]
59+ COPY . /workspace
60+ WORKDIR /workspace
61+ CMD ["/workspace /bin/boot"]
5262EXPOSE 8000
0 commit comments