-
Notifications
You must be signed in to change notification settings - Fork 8
Infrastructure for Container #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1f6a588
add Dockerfile
8d0ad58
finalize Dockerfile and workflows
b6420cc
fix style
723889f
upload to dockerhub
22bd240
build for arm64,amd64
867caa5
next try
9936b9d
use oci exporter
0befa75
use install script for miniconda
2efc37a
fixes for entrypoint
a658469
fix format
912760b
use debian:bookworm-slim
28eb2e2
Undo last change
AnnikaLau e36ccb3
Update build-container.yml
jonasjucker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,44 @@ | ||
| name: Build Docker Container | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| submodules: true | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v1 | ||
|
|
||
| - name: Log in to Docker Hub | ||
| uses: docker/login-action@v1 | ||
| with: | ||
| username: c2sm | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
|
||
| - name: Build Docker image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| file: ./Dockerfile | ||
| push: false | ||
| tags: c2sm/probtest:latest | ||
| platforms: linux/amd64,linux/arm64 | ||
| outputs: type=oci,dest=probtest_image.tar | ||
|
|
||
| - name: Upload Docker image as artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: probtest_image.tar | ||
| path: probtest_image.tar |
This file contains hidden or 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,59 @@ | ||
| name: Deploy image to DockerHub and GitHub Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - '*' | ||
|
|
||
| jobs: | ||
| build_and_release: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Set up Git repository | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| submodules: true # Checkout submodules | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v1 | ||
|
|
||
| - name: Log in to Docker Hub | ||
| uses: docker/login-action@v1 | ||
| with: | ||
| username: c2sm | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
|
||
| - name: Build and Save Docker image | ||
| id: build_docker_image | ||
| uses: docker/build-push-action@v2 | ||
| with: | ||
| context: . | ||
| file: ./Dockerfile | ||
| push: true | ||
| tags: c2sm/probtest:${{ github.ref_name }} | ||
| platforms: linux/amd64,linux/arm64 | ||
| outputs: type=oci,dest=probtest_image.tar | ||
|
|
||
| - name: Upload Docker image as artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: probtest_image.tar | ||
| path: probtest_image.tar | ||
|
|
||
| - name: Get release | ||
| id: get_release | ||
| uses: bruceadams/get-release@v1.3.2 | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
|
|
||
| - name: Upload Release Asset | ||
| id: upload-release-asset | ||
| uses: actions/upload-release-asset@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| upload_url: ${{ steps.get_release.outputs.upload_url }} | ||
| asset_path: probtest_image.tar | ||
| asset_name: probtest_image.tar | ||
| asset_content_type: application/x-tar |
This file contains hidden or 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
This file contains hidden or 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,41 @@ | ||
| # Use the official Ubuntu base image | ||
| FROM ubuntu:latest | ||
|
|
||
| # Set environment variables | ||
| ENV TZ=Europe/Zurich | ||
|
|
||
| # Install necessary dependencies | ||
| RUN apt-get update && apt-get install -y \ | ||
| wget \ | ||
| bzip2 \ | ||
| ca-certificates \ | ||
| curl \ | ||
| git \ | ||
| # Install tzdata to set the timezone, otherwise timing tests of probtest will fail with | ||
| # ValueError: time data 'Sun Jun 26 20:11:23 CEST 2022' does not match format '%a %b %d %H:%M:%S %Z %Y' | ||
| tzdata \ | ||
| && apt-get clean | ||
|
|
||
|
|
||
| COPY . /probtest | ||
| RUN cd /probtest && ./setup_miniconda.sh -p /opt/conda | ||
| # Add conda to PATH | ||
| ENV PATH=/opt/conda/miniconda/bin:$PATH | ||
|
|
||
| # only unpinned env works on aarch64 | ||
| RUN ARCH=$(uname -m) && \ | ||
| cd /probtest && chmod +x /probtest/setup_env.sh && \ | ||
| if [ "$ARCH" = "aarch64" ]; then \ | ||
| ./setup_env.sh -u -n probtest; \ | ||
| else \ | ||
| ./setup_env.sh -n probtest; \ | ||
| fi | ||
|
|
||
| # Test probtest | ||
| RUN cd /probtest && conda run --name probtest pytest -v -s --cov --cov-report=term tests/ | ||
|
|
||
| # Set the working directory | ||
| WORKDIR /probtest | ||
|
|
||
| SHELL ["/bin/bash", "-c"] | ||
| ENTRYPOINT ["conda", "run", "--name", "probtest", "/bin/bash", "-c"] | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.