Skip to content

Commit

Permalink
migrate to github repo for sftp alpine image
Browse files Browse the repository at this point in the history
  • Loading branch information
JosiahSiegel committed Jul 22, 2024
1 parent 3a590ad commit 257f27d
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/publish_docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- master
- josiahsiegel/update/sftpalpine-image
schedule:
- cron: "0 0 1 * *"

Expand All @@ -20,6 +21,7 @@ jobs:
has_tfcli_change: ${{ steps.skip_check.outputs.tfcli && github.event_name != 'schedule'}}
has_dnsmasq_change: ${{ steps.skip_check.outputs.dnsmasq || github.event_name == 'schedule'}}
run_publish_sftp: ${{ steps.check_sftp_image.outputs.run_job }}
run_publish_sftp_alpine: ${{ steps.check_sftp_alpine_image.outputs.run_job }}
steps:
- name: "Check out changes"
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
Expand All @@ -31,6 +33,13 @@ jobs:
dnsmasq:
- 'operations/dnsmasq/**'
- name: Log In to the Container Registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Check sftp image
id: check_sftp_image
run: |
Expand All @@ -47,6 +56,24 @@ jobs:
echo "run_job=false" >> $GITHUB_OUTPUT
fi
- name: Check sftp alpine image
id: check_sftp_alpine_image
run: |
docker pull atmoz/sftp:alpine
docker tag atmoz/sftp:alpine ghcr.io/cdcgov/prime-reportstream_sftp:alpine
docker push ghcr.io/cdcgov/prime-reportstream_sftp:alpine
docker pull ${{ env.REGISTRY }}/${{ env.SFTP_IMAGE_NAME }}:alpine
LATEST_IMAGE_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' atmoz/sftp:alpine)
REPO_IMAGE_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ env.REGISTRY }}/${{ env.SFTP_IMAGE_NAME }}:alpine 2> /dev/null || true)
if [ "$LATEST_IMAGE_DIGEST" != "$REPO_IMAGE_DIGEST" ]; then
echo "image outdated"
echo "run_job=true" >> $GITHUB_OUTPUT
else
echo "image current"
echo "run_job=false" >> $GITHUB_OUTPUT
fi
publish_dnsmasq:
name: Publish dnsmasq
needs: pre_job
Expand Down Expand Up @@ -109,3 +136,31 @@ jobs:
- name: Push to the Container Registry
run: |
docker push ${{ env.REGISTRY }}/${{ env.SFTP_IMAGE_NAME }} --all-tags
publish_sftp_alpine:
name: Publish SFTP Alpine
needs: pre_job
if: ${{ needs.pre_job.outputs.run_publish_sftp_alpine == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check Out Changes
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332

- name: Log In to the Container Registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Tag Image
run: |
docker pull atmoz/sftp:alpine
docker tag atmoz/sftp:alpine ${{ env.REGISTRY }}/${{ env.SFTP_IMAGE_NAME }}:alpine
- name: Push to the Container Registry
run: |
docker push ${{ env.REGISTRY }}/${{ env.SFTP_IMAGE_NAME }}:alpine

0 comments on commit 257f27d

Please sign in to comment.