Skip to content

Commit

Permalink
fix(ci): docker image push fixes
Browse files Browse the repository at this point in the history
Co-Authored-By: Ken Brewer <kenibrewer@users.noreply.github.com>
  • Loading branch information
d33bs and kenibrewer committed Apr 3, 2024
1 parent 3286270 commit 0c56eb6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,14 @@ jobs:
# Gather and prepare the dynamic version and other vars for use with work below.
# For example, 1.1.0.post6.dev0+bc093ef becomes 1.1.0.post6.dev0_bc093ef
- name: Gather dynamic version and set env var
if: (github.event_name == 'push'|| github.event_name == 'schedule') && github.ref == 'refs/heads/main'
id: env-vars
run: >-
echo "CLEAN_VERSION=$(echo ${{ env.sdist_filename }} | tr '+' '_' )" >> "$GITHUB_OUTPUT" &&
echo "CLEAN_VERSION=$(echo ${{ env.sdist_extracted_name }} | tr '+' '_' )" >> "$GITHUB_OUTPUT" &&
echo "DATE_TAG=$(date +'%y%m%d')" >> "$GITHUB_OUTPUT"
- name: Login to Docker Hub
# only run this task if we have a pull request merged or the schedule triggers from main
if: (github.event.pull_request.merged || github.event_name == 'schedule') && github.ref == 'refs/heads/main'
if: (github.event_name == 'push'|| github.event_name == 'schedule') && github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
Expand All @@ -220,24 +221,24 @@ jobs:
with:
context: "${{ env.sdist_extracted_name }}"
push: true
file: ../build/docker/Dockerfile
file: ./build/docker/Dockerfile
target: production
tags: cytomining/pycytominer:${{ steps.env-vars.outputs.CLEAN_VERSION }}_${{ steps.env-vars.outputs.DATE_TAG }}
# Docker image push based on GitHub pushes to main
- name: Push-based docker image push
# only run this task if we have a pull request which is merged
if: github.event.pull_request.merged && github.ref == 'refs/heads/main' && github.repository == 'cytomining/pycytominer'
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'cytomining/pycytominer'
uses: docker/build-push-action@v5
with:
context: "${{ env.sdist_extracted_name }}"
push: true
file: ../build/docker/Dockerfile
file: ./build/docker/Dockerfile
target: production
tags: cytomining/pycytominer:latest,cytomining/pycytominer:${{ steps.env-vars.outputs.CLEAN_VERSION }}
# update docker hub description using readme on merge
- name: Docker Hub
# only run this task if we have a pull request which is merged
if: github.event.pull_request.merged && github.ref == 'refs/heads/main' && github.repository == 'cytomining/pycytominer'
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'cytomining/pycytominer'
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKER_USER }}
Expand Down
6 changes: 5 additions & 1 deletion build/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ RUN pip install --no-cache-dir poetry
FROM base as production

# copy the pycytominer source into image
COPY . .
COPY README.md pyproject.toml poetry.lock ./
COPY pycytominer ./pycytominer

# install pycytominer using poetry root dependencies and all extras
RUN poetry install --all-extras -v --no-interaction

# create stage for production build (no dev or non-essential deps)
FROM production as testing

# copy the tests dir for testing purposes
COPY tests ./tests

# install pycytominer from poetry with group deps and all extras for testing
RUN poetry install --with dev --all-extras -v --no-interaction

0 comments on commit 0c56eb6

Please sign in to comment.