chore: unify packaging around uv
This commit is contained in:
+7
-6
@@ -9,7 +9,7 @@ ARG DEPLOY_DIR
|
||||
ARG USERNAME
|
||||
|
||||
# Install dependencies
|
||||
RUN pip install pipenv
|
||||
RUN pip install --no-cache-dir uv
|
||||
|
||||
# Add app user
|
||||
RUN adduser --disabled-password ${USERNAME}
|
||||
@@ -27,8 +27,9 @@ WORKDIR ${DEPLOY_DIR}
|
||||
COPY stw_potsdam/ ./stw_potsdam
|
||||
COPY tests ./tests
|
||||
COPY Makefile .
|
||||
COPY Pipfile .
|
||||
COPY Pipfile.lock .
|
||||
COPY README.md .
|
||||
COPY pyproject.toml .
|
||||
COPY uv.lock .
|
||||
|
||||
# Apply app user to app folder
|
||||
RUN chown -R ${USERNAME} .
|
||||
@@ -48,7 +49,7 @@ RUN apt-get update && apt-get install -y build-essential python3-dev
|
||||
|
||||
# Install environment
|
||||
USER ${USERNAME}
|
||||
RUN pipenv install --dev
|
||||
RUN uv sync --frozen --extra dev
|
||||
|
||||
# Run tests
|
||||
RUN make test
|
||||
@@ -58,7 +59,7 @@ RUN rm -rf .venv
|
||||
RUN rm -rf ./tests ./Makefile
|
||||
|
||||
# Install production environment
|
||||
RUN pipenv install --deploy
|
||||
RUN uv sync --frozen --no-dev
|
||||
|
||||
|
||||
### Production container
|
||||
@@ -82,6 +83,6 @@ ENV LISTEN_PORT=${LISTEN_PORT}
|
||||
ENV LISTEN=0.0.0.0:${LISTEN_PORT}
|
||||
|
||||
EXPOSE ${LISTEN_PORT}
|
||||
CMD ["pipenv", "run", "uwsgi", "--master", "--http11-socket", "$LISTEN", "--plugins", "python", "--protocol", "uwsgi", "--wsgi", "stw_potsdam.views:app", "--virtualenv", "./.venv"]
|
||||
CMD ["sh", "-c", "uv run uwsgi --master --http11-socket \"$LISTEN\" --plugins python --protocol uwsgi --wsgi stw_potsdam.views:app --virtualenv ./.venv"]
|
||||
|
||||
HEALTHCHECK --interval=15s --timeout=3s CMD curl -f http://127.0.0.1:$LISTEN_PORT/health_check || exit 1
|
||||
|
||||
Reference in New Issue
Block a user