Skip to content

Commit

Permalink
split deps
Browse files Browse the repository at this point in the history
  • Loading branch information
luizirber committed Aug 1, 2024
1 parent d87cf70 commit 82a9996
Show file tree
Hide file tree
Showing 3 changed files with 462 additions and 237 deletions.
19 changes: 11 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ FROM ghcr.io/prefix-dev/pixi:0.26.1 AS build
COPY . /app
WORKDIR /app
RUN pixi run build-wheel
RUN pixi run postinstall-production
RUN pixi shell-hook -e prod > /shell-hook
RUN echo 'exec "$@"' >> /shell-hook
RUN pixi run -e web postinstall-prod
RUN pixi shell-hook -e web > /shell-hook-web
RUN echo 'exec "$@"' >> /shell-hook-web
RUN pixi run -e worker postinstall-prod
RUN pixi shell-hook -e worker > /shell-hook-worker
RUN echo 'exec "$@"' >> /shell-hook-worker

#--------------------

FROM ubuntu:24.04 AS web

# only copy the production environment into prod container
COPY --from=build /app/.pixi/envs/prod /app/.pixi/envs/prod
COPY --from=build /shell-hook /shell-hook
COPY --from=build /app/.pixi/envs/web /app/.pixi/envs/web
COPY --from=build /shell-hook-web /shell-hook

RUN groupadd user && \
useradd --create-home --home-dir /home/user -g user -s /bin/bash user
Expand All @@ -23,7 +26,7 @@ COPY config/ /app/config

WORKDIR /app

USER user
#USER user

ENTRYPOINT ["/bin/bash", "/shell-hook"]
CMD ["gunicorn", "-b", "0.0.0.0:5000", "--access-logfile", "-", "'wortapp:create_app()'"]
Expand All @@ -33,8 +36,8 @@ CMD ["gunicorn", "-b", "0.0.0.0:5000", "--access-logfile", "-", "'wortapp:create
FROM ubuntu:24.04 AS worker

# only copy the production environment into prod container
COPY --from=build /app/.pixi/envs/prod /app/.pixi/envs/prod
COPY --from=build /shell-hook /shell-hook
COPY --from=build /app/.pixi/envs/worker /app/.pixi/envs/worker
COPY --from=build /shell-hook-worker /shell-hook

RUN groupadd user && \
useradd --create-home --home-dir /home/user -g user -s /bin/bash user
Expand Down
Loading

0 comments on commit 82a9996

Please sign in to comment.