diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58a0373..0f17654 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ on: jobs: test-pfcon: name: tests (pfcon) - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - name: Start Docker Swarm @@ -28,7 +28,7 @@ jobs: docker swarm leave --force test-cube: name: tests (CUBE) - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - run: docker build -t localhost/fnndsc/pfcon . @@ -38,7 +38,7 @@ jobs: build: needs: [test-pfcon, test-cube] - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - name: Install pixi diff --git a/Dockerfile b/Dockerfile index 378861b..f131559 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,32 @@ -FROM ghcr.io/prefix-dev/pixi:0.27.1 AS build +FROM ghcr.io/prefix-dev/pixi:0.27.1 AS install COPY . /app WORKDIR /app RUN --mount=type=cache,target=/root/.cache/rattler/cache,sharing=locked pixi install +# development stage +FROM install AS dev + +CMD ["pixi", "run", "python", "-m", "pfcon"] +EXPOSE 5005 + +# production build stage +FROM install AS build + RUN pixi run build ARG ENVIRONMENT=prod RUN printf '#!/bin/sh\n%s\nexec "$@"' "$(pixi shell-hook -e ${ENVIRONMENT})" > /entrypoint.sh RUN chmod +x /entrypoint.sh - -FROM build as prod-build - # must be the last command of this stage, or else pixi will overwrite the installed package. RUN pixi run postinstall-production +# production minimal image FROM docker.io/library/debian:bookworm-slim -COPY --from=prod-build /app/.pixi/envs/${ENVIRONMENT} /app/.pixi/envs/${ENVIRONMENT} -COPY --from=prod-build /entrypoint.sh /entrypoint.sh +COPY --from=build /app/.pixi/envs/${ENVIRONMENT} /app/.pixi/envs/${ENVIRONMENT} +COPY --from=build /entrypoint.sh /entrypoint.sh ENTRYPOINT [ "/entrypoint.sh" ] CMD ["gunicorn", "--bind", "0.0.0.0:5005", "--workers", "8", "--timeout", "3600", "pfcon.wsgi:application"] diff --git a/swarm/docker-compose_dev.yml b/swarm/docker-compose_dev.yml index 212d0b2..fe333ed 100755 --- a/swarm/docker-compose_dev.yml +++ b/swarm/docker-compose_dev.yml @@ -15,7 +15,7 @@ services: image: localhost:5000/fnndsc/pfcon:dev build: context: .. - target: build + target: dev args: ENVIRONMENT: local stdin_open: true # docker run -i diff --git a/swarm/docker-compose_dev_innetwork.yml b/swarm/docker-compose_dev_innetwork.yml index 19fc2dc..91436fd 100755 --- a/swarm/docker-compose_dev_innetwork.yml +++ b/swarm/docker-compose_dev_innetwork.yml @@ -15,7 +15,7 @@ services: image: localhost:5000/fnndsc/pfcon:dev build: context: .. - target: build + target: dev args: ENVIRONMENT: local stdin_open: true # docker run -i diff --git a/swarm/docker-compose_dev_innetwork_fs.yml b/swarm/docker-compose_dev_innetwork_fs.yml index ca96fc7..89388c4 100755 --- a/swarm/docker-compose_dev_innetwork_fs.yml +++ b/swarm/docker-compose_dev_innetwork_fs.yml @@ -15,7 +15,7 @@ services: image: localhost:5000/fnndsc/pfcon:dev build: context: .. - target: build + target: dev args: ENVIRONMENT: local stdin_open: true # docker run -i