-
Notifications
You must be signed in to change notification settings - Fork 7
Feature/issue 178/build docker image #194
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 8 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5ba30b0
Initial updates for docker
Asanto32 e03801b
Typos for output type
Asanto32 0f96721
Merge branch 'main' into feature/issue-178/build-docker-image
Asanto32 870f32e
Merge branch 'main' into feature/issue-178/build-docker-image
Asanto32 d79615b
Adding entrypoint for complex handling
Asanto32 8b4c49a
Update release.yaml
Asanto32 819ee24
Update release.yaml
Asanto32 d7120e9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 10b4ab5
Update README.md
Asanto32 45da9d3
Update README.md
Asanto32 ea2ef03
Update test for new version of click
Asanto32 97270cd
Fix entrypoint
Asanto32 11354ac
Update release.yaml
Asanto32 8e808e2
Merge branch 'main' into feature/issue-178/build-docker-image
Asanto32 f160266
Reverting accidental merge conflict acceptance
Asanto32 2076d5f
Update release.yaml
Asanto32 8326a67
Update release.yaml
Asanto32 d4aebf3
Update release.yaml
Asanto32 d453f27
Update README.md
Asanto32 32bdd4d
Create .dockerignore
Asanto32 b2e708b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 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,49 @@ | ||
| name: Publish Docker image | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| tags: | ||
| - v* | ||
|
|
||
|
|
||
| jobs: | ||
| push_to_registry: | ||
| name: Push Docker image to Docker Hub | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out the repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| lfs: true | ||
|
|
||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
|
|
||
| - name: Log in to Docker Hub | ||
| uses: docker/login-action@v3 | ||
|
|
||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
|
||
|
|
||
| - name: Extract metadata (tags, labels) for Docker | ||
| id: meta | ||
| uses: docker/metadata-action@v5.5.1 | ||
|
|
||
| with: | ||
| images: adamsanto/wristpy | ||
|
|
||
|
|
||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v5.1.0 | ||
|
|
||
| with: | ||
| platforms: linux/amd64,linux/arm64 | ||
| context: . | ||
| file: ./Dockerfile | ||
| push: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
|
|
||
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,31 @@ | ||
| FROM python:3.11-buster | ||
|
|
||
| WORKDIR /app | ||
| COPY . /app/ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you make this copy more specific, or add a .dockerignore, to avoid copying unnecessary large files like the documentation pngs into the docker image? |
||
|
|
||
|
|
||
| ENV INPUT_DIR=/data | ||
| ENV OUTPUT_DIR=/output | ||
| ENV OUTPUT_TYPE=.csv | ||
| ENV CALIBRATOR=none | ||
| ENV ACTIVITY_METRIC=enmo | ||
| ENV EPOCH_LENGTH=5 | ||
| ENV NONWEAR=ggir | ||
| ENV THRESHOLDS="" | ||
|
|
||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| build-essential \ | ||
| gfortran \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN pip install poetry && \ | ||
| poetry config virtualenvs.create false && \ | ||
| poetry install --only main | ||
|
|
||
| RUN mkdir -p $INPUT_DIR $OUTPUT_DIR | ||
|
|
||
| COPY entrypoint.sh /entrypoint.sh | ||
| RUN chmod +x /entrypoint.sh | ||
|
|
||
| ENTRYPOINT ["/entrypoint.sh"] | ||
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,31 @@ | ||
| #!/bin/bash | ||
| # Wristpy Docker Entrypoint Script | ||
|
|
||
| CMD="poetry run wristpy $INPUT_DIR --output $OUTPUT_DIR" | ||
|
|
||
|
|
||
| if [ -n "$OUTPUT_TYPE" ]; then | ||
| CMD="$CMD --output-filetype $OUTPUT_TYPE" | ||
| fi | ||
|
|
||
| CMD="$CMD --calibrator $CALIBRATOR" | ||
| CMD="$CMD --activity-metric $ACTIVITY_METRIC" | ||
| CMD="$CMD --epoch-length $EPOCH_LENGTH" | ||
|
|
||
|
|
||
| if [ -n "$NONWEAR" ]; then | ||
| IFS="," read -ra ALGOS <<< "$NONWEAR" | ||
| for algo in "${ALGOS[@]}"; do | ||
| CMD="$CMD --nonwear-algorithm $algo" | ||
| done | ||
| fi | ||
|
|
||
| if [ -n "$THRESHOLDS" ]; then | ||
| THRESHOLD_VALUES=$(echo $THRESHOLDS | tr "," " ") | ||
| if [ -n "$THRESHOLD_VALUES" ]; then | ||
| CMD="$CMD --thresholds $THRESHOLD_VALUES" | ||
| fi | ||
| fi | ||
|
|
||
| echo "Running: $CMD" | ||
| exec $CMD |
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.