-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94462c4
commit 823d813
Showing
12 changed files
with
4,995 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,7 @@ Dockerfile | |
LICENSE | ||
CHRIS_REMOTE_FS | ||
swift_storage | ||
|
||
dist/ | ||
.pixi/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# GitHub syntax highlighting | ||
pixi.lock linguist-language=YAML linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,26 +38,40 @@ jobs: | |
|
||
build: | ||
needs: [test-pfcon, test-cube] | ||
if: github.event_name == 'push' || github.event_name == 'release' | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install pixi | ||
id: install-pixi | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
uses: prefix-dev/[email protected] | ||
with: | ||
fetch-depth: "0" | ||
pixi-version: v0.28.2 | ||
- name: Set version | ||
id: set-version | ||
if: steps.install-pixi.outcome == 'success' | ||
run: | ||
ref_name='${{ github.ref_name }}' | ||
version_number="${ref_name:1}" | ||
pixi project version set "$version_number" | ||
echo "LABEL org.opencontainers.image.version=\"$version_number\"" >> Dockerfile | ||
echo "version=$version_number" >> "$GITHUB_OUTPUT" | ||
- name: Get build tags | ||
id: info | ||
shell: python | ||
run: | | ||
import os | ||
import itertools | ||
short_sha = os.getenv('GITHUB_SHA', 'unknown')[:7] | ||
commit_sha = '${{ github.sha }}' | ||
short_sha = commit_sha[:7] | ||
git_refs = [] | ||
if os.getenv('GITHUB_REF', '').startswith('refs/tags/v'): | ||
version_from_tag = os.getenv('GITHUB_REF')[11:] | ||
git_refs.append(version_from_tag.replace('+', '.')) | ||
version_number = '${{ steps.set-version.outputs.version }}' | ||
if version_number: | ||
sanitized_version_number = version_number.replace('+', '.') | ||
git_refs.append(sanitized_version_number) | ||
registries = ['docker.io', 'ghcr.io'] | ||
repo = os.environ['GITHUB_REPOSITORY'].lower() | ||
repo = '${{ github.repository }}'.lower() | ||
tags = ['latest'] + git_refs | ||
names = ','.join(''.join(c) for c in itertools.product( | ||
(r + '/' for r in registries), | ||
|
@@ -69,24 +83,26 @@ jobs: | |
- uses: docker/setup-qemu-action@v3 | ||
- uses: docker/setup-buildx-action@v3 | ||
- name: Login to DockerHub | ||
id: login-dockerhub | ||
if: github.event_name == 'push' | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- name: Login to GitHub Container Registry | ||
id: login-ghcr | ||
if: github.event_name == 'push' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
uses: docker/build-push-action@v6 | ||
with: | ||
build-args: | | ||
ENVIRONMENT=production | ||
BUILD_VERSION=${{ github.ref_name }} | ||
push: true | ||
build-args: ENVIRONMENT=prod | ||
push: ${{ steps.login-dockerhub.outcome }} == 'success' && ${{ steps.login-ghcr.outcome }} == 'success' | ||
context: . | ||
file: ./Dockerfile | ||
tags: "${{ steps.info.outputs.tags }}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,7 @@ | |
dc.out | ||
CHRIS_REMOTE_FS/ | ||
swift_storage/ | ||
|
||
# pixi environments | ||
.pixi | ||
*.egg-info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,32 @@ | ||
# | ||
# Docker file for pfcon image | ||
# | ||
# Build production image: | ||
# | ||
# docker build -t <name> . | ||
# | ||
# For example if building a local production image: | ||
# | ||
# docker build -t local/pfcon . | ||
# | ||
# Build development image: | ||
# | ||
# docker build --build-arg ENVIRONMENT=local -t <name>:<tag> . | ||
# | ||
# For example if building a local development image: | ||
# | ||
# docker build --build-arg ENVIRONMENT=local -t local/pfcon:dev . | ||
# | ||
# In the case of a proxy (located at say proxy.tch.harvard.edu:3128), do: | ||
# | ||
# export PROXY="http://proxy.tch.harvard.edu:3128" | ||
# | ||
# then add to any of the previous build commands: | ||
# | ||
# --build-arg http_proxy=${PROXY} | ||
# | ||
# For example if building a local development image: | ||
# | ||
# docker build --build-arg http_proxy=${PROXY} --build-arg ENVIRONMENT=local -t local/pfcon:dev . | ||
# | ||
|
||
FROM python:3.10.5-bullseye | ||
FROM ghcr.io/prefix-dev/pixi:0.27.1 AS build | ||
|
||
COPY . /app | ||
WORKDIR /app | ||
|
||
COPY ./requirements ./requirements | ||
ARG ENVIRONMENT=production | ||
RUN pip install --no-cache-dir -r /app/requirements/$ENVIRONMENT.txt | ||
RUN --mount=type=cache,target=/root/.cache/rattler/cache,sharing=locked pixi install | ||
|
||
COPY . . | ||
ARG BUILD_VERSION=unknown | ||
RUN if [ "$ENVIRONMENT" = "local" ]; then pip install -e .; else pip install .; fi | ||
RUN pixi run build | ||
|
||
EXPOSE 5005 | ||
ARG ENVIRONMENT=prod | ||
RUN printf '#!/bin/sh\n%s\nexec "$@"' "$(pixi shell-hook -e ${ENVIRONMENT})" > /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
# must be the last command of this stage, or else pixi will overwrite the installed package. | ||
RUN pixi run postinstall-production | ||
|
||
FROM docker.io/library/debian:bookworm-slim | ||
|
||
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"] | ||
|
||
EXPOSE 5005 | ||
|
||
LABEL org.opencontainers.image.authors="FNNDSC <[email protected]>" \ | ||
org.opencontainers.image.title="pfcon" \ | ||
org.opencontainers.image.description="ChRIS compute resource controller" \ | ||
org.opencontainers.image.url="https://chrisproject.org/" \ | ||
org.opencontainers.image.source="https://github.com/FNNDSC/pfcon" \ | ||
org.opencontainers.image.version=$BUILD_VERSION \ | ||
org.opencontainers.image.revision=$BUILD_VERSION \ | ||
org.opencontainers.image.licenses="MIT" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.