Skip to content

Commit 7648e11

Browse files
committed
updates Dockerfile
1 parent 44a5d55 commit 7648e11

File tree

5 files changed

+18
-61
lines changed

5 files changed

+18
-61
lines changed

docker/Dockerfile

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,14 @@ LABEL distro="tests"
6868
LABEL org.opencontainers.image.created="$BUILD_DATE"
6969
LABEL org.opencontainers.image.version="$VERSION"
7070

71-
ENV PATH=/app/.venv/bin:/usr/local/bin/:/usr/bin:/bin \
71+
ENV PATH=/venv/bin:/usr/local/bin/:/usr/bin:/bin \
7272
DJANGO_SETTINGS_MODULE=country_workspace.config.settings \
7373
PYTHONUNBUFFERED=1 \
7474
PYTHONDONTWRITEBYTECODE=1 \
75-
PYTHONPATH=""\
75+
UV_PROJECT_ENVIRONMENT=/venv \
76+
VIRTUAL_ENV=/venv \
7677
UWSGI_PROCESSES=4
78+
7779
WORKDIR /app
7880
COPY uv.lock README.md MANIFEST.in pyproject.toml /app/
7981
COPY src /app/src/
@@ -94,8 +96,10 @@ ENV PATH=/app/.venv/bin:/usr/local/bin/:/usr/bin:/bin \
9496
DJANGO_SETTINGS_MODULE=country_workspace.config.settings \
9597
PYTHONUNBUFFERED=1 \
9698
PYTHONDONTWRITEBYTECODE=1 \
97-
PYTHONPATH=""\
99+
UV_PROJECT_ENVIRONMENT=/venv \
100+
VIRTUAL_ENV=/venv \
98101
UWSGI_PROCESSES=4
102+
99103
WORKDIR /app
100104
COPY uv.lock README.md MANIFEST.in pyproject.toml /app/
101105
COPY src /app/src/
@@ -114,7 +118,7 @@ ARG BUILD_DATE
114118
ARG GIT_SHA
115119
ARG BRANCH
116120

117-
ENV PATH=/app/.venv/bin:/usr/local/bin/:/usr/bin:/bin \
121+
ENV PATH=/venv/bin:/usr/local/bin/:/usr/bin:/bin \
118122
BUILD_DATE=$BUILD_DATE \
119123
GIT_SHA=$GIT_SHA \
120124
VERSION=$VERSION \
@@ -124,6 +128,8 @@ ENV PATH=/app/.venv/bin:/usr/local/bin/:/usr/bin:/bin \
124128
STATIC_URL="/static/" \
125129
PYTHONPATH=""\
126130
PGSSLCERT="/tmp/postgresql.crt" \
131+
UV_PROJECT_ENVIRONMENT=/venv \
132+
VIRTUAL_ENV=/venv \
127133
UWSGI_PROCESSES=4
128134

129135
RUN <<EOF cat> /RELEASE
@@ -135,20 +141,14 @@ EOF
135141
WORKDIR /app
136142
COPY docker/conf /conf/
137143
COPY docker/bin/* /usr/local/bin/
138-
COPY LICENSE.md README.md /
139-
COPY src /app/src/
140-
RUN rm -fr /app/src/
141144

145+
COPY . /app/
142146

143-
COPY --chown=hope:unicef --from=production /app/.venv /app/.venv
147+
COPY --chown=hope:unicef --from=production /venv /venv
144148
COPY --from=builder /usr/local/bin/uwsgi /usr/local/bin/uv /usr/local/bin/
145149
RUN --mount=type=cache,target=/root/.uv-cache \
146-
--mount=type=bind,source=uv.lock,target=/app/uv.lock \
147-
--mount=type=bind,source=pyproject.toml,target=/app/pyproject.toml \
148-
--mount=type=bind,source=MANIFEST.in,target=/app/MANIFEST.in \
149-
--mount=type=bind,source=README.md,target=/app/README.md \
150-
--mount=type=bind,source=./src/country_workspace,target=/app/src/country_workspace \
151-
uv --cache-dir=/root/.uv-cache pip install --link-mode=copy --no-deps .
150+
uv --cache-dir=/root/.uv-cache pip install --link-mode=copy --no-deps . \
151+
&& rm -fr /app
152152

153153

154154
EXPOSE 8000

docker/bin/docker-entrypoint.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ case "$1" in
1616
fi
1717
set -- tini -- "$@"
1818
set -- uwsgi --http :8000 \
19+
-H /venv \
1920
--module country_workspace.config.wsgi \
2021
--mimefile=/conf/mime.types \
2122
--uid hope \
@@ -29,16 +30,16 @@ case "$1" in
2930
;;
3031
worker)
3132
set -- tini -- "$@"
32-
set -- gosu user:app celery -A country_workspace.config.celery worker -E --loglevel=ERROR --concurrency=4
33+
set -- gosu hope:unicef celery -A country_workspace.config.celery worker --statedb worker-E --loglevel=ERROR --concurrency=4
3334
;;
3435
beat)
3536
set -- tini -- "$@"
36-
set -- gosu user:app celery -A country_workspace.config.celery beat --loglevel=ERROR --scheduler django_celery_beat.schedulers:DatabaseScheduler
37+
set -- gosu hope:unicef celery -A country_workspace.config.celery beat --loglevel=ERROR --scheduler django_celery_beat.schedulers:DatabaseScheduler
3738
;;
3839
flower)
3940
export DATABASE_URL="sqlite://:memory:"
4041
set -- tini -- "$@"
41-
set -- gosu user:app celery -A country_workspace.config.celery flower
42+
set -- gosu hope:unicef celery -A country_workspace.config.celery flower
4243
;;
4344
esac
4445

docker/conf/uwsgi.ini

Lines changed: 0 additions & 28 deletions
This file was deleted.

pyproject.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ docs = [
6565
"mkdocs-gen-files>=0.5.0",
6666
]
6767

68-
distribution = [
69-
"uwsgi>=2.0.27",
70-
]
71-
7268
[tool.uv]
7369
package = true
7470
dev-dependencies = [

uv.lock

Lines changed: 0 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)