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="/var/lib/postgresql/data" \
714 PYTHON_VERSION="3.10.2" \
@@ -13,12 +20,15 @@ RUN buildDeps='gcc rustc cargo libffi-dev musl-dev libldap2-dev libsasl2-dev'; \
1320 && install-stack python $PYTHON_VERSION \
1421 && install-stack postgresql $POSTGRES_VERSION \
1522 && install-stack gosu $GOSU_VERSION && . init-stack \
16- && python3 -m venv /app/.venv \
17- && source /app/.venv/bin/activate \
18- && pip3 install --disable-pip-version-check --no-cache-dir -r /app/requirements.txt \
19- && pip3 install --disable-pip-version-check --no-cache-dir -r /app/dev_requirements.txt \
23+ && python3 -m venv /workspace/.venv \
24+ && source /workspace/.venv/bin/activate \
25+ && pip3 install --disable-pip-version-check --no-cache-dir -r /workspace/requirements.txt \
26+ && pip3 install --disable-pip-version-check --no-cache-dir -r /workspace/dev_requirements.txt \
27+ && chown -R drycc:drycc /workspace \
28+ # set env
29+ && echo "source /workspace/.venv/bin/activate" >> /opt/drycc/python/profile.d/python.sh \
2030 # cleanup
21- && scanelp /app /.venv/lib > runtime.txt \
31+ && scanelp /workspace /.venv/lib > runtime.txt \
2232 && apt-get purge -y --auto-remove $buildDeps \
2333 && install-packages $(< runtime.txt) \
2434 && apt-get autoremove -y \
@@ -42,7 +52,7 @@ RUN buildDeps='gcc rustc cargo libffi-dev musl-dev libldap2-dev libsasl2-dev'; \
4252 && chown -R postgres:postgres /run/postgresql $PGDATA \
4353 && gosu postgres initdb -D $PGDATA
4454
45- COPY . /app
46- WORKDIR /app
47- CMD ["/app /bin/boot"]
55+ COPY . /workspace
56+ WORKDIR /workspace
57+ CMD ["/workspace /bin/boot"]
4858EXPOSE 8000
0 commit comments