From 91926dd2cd0a2008adbeb1b9fec12d84b8496204 Mon Sep 17 00:00:00 2001 From: Seth For Privacy <40500387+sethforprivacy@users.noreply.github.com> Date: Tue, 23 Apr 2024 10:06:15 -0400 Subject: Add Dockerfile and GAs for Docker image deployment * Initial Dockerfile and Github Actions * Properly name final Docker build stage * Add tag for package.version * Correct cargo-get syntax * Fix version tagging and add sentrum.toml to .gitignore * Fix newlines and add Docker examples * Fix branch on Github Action and minor copy update --- .github/workflows/update-base-image.yml | 55 +++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/update-base-image.yml (limited to '.github/workflows/update-base-image.yml') diff --git a/.github/workflows/update-base-image.yml b/.github/workflows/update-base-image.yml new file mode 100644 index 0000000..5159808 --- /dev/null +++ b/.github/workflows/update-base-image.yml @@ -0,0 +1,55 @@ +name: "Update image and push to Github Packages and Docker Hub weekly" + +on: + schedule: + - cron: "0 12 * * 1" # Run every Monday at noon. + workflow_dispatch: + +jobs: + rebuild-container: + name: "Rebuild Container with the latest base image" + runs-on: ubuntu-latest + steps: + - + name: Prepare outputs + id: prep + run: | + echo "::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')" + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3.0.0 + with: + platforms: linux/arm64 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.3.0 + - + name: Login to GitHub Container Registry + uses: docker/login-action@v3.1.0 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Checkout repository + uses: actions/checkout@v4 + - + name: Get package version + id: cargo-get + uses: nicolaiunrein/cargo-get@master + with: + subcommand: package.version + - + name: Build and push to Docker Hub and GitHub Packages Docker Registry + id: docker_build + uses: docker/build-push-action@v5.3.0 + with: + push: true + platforms: linux/amd64,linux/arm64 + tags: | + ghcr.io/${{ github.repository_owner }}/sentrum:latest + ghcr.io/${{ github.repository_owner }}/sentrum:${{ steps.cargo-get.outputs.metadata }} + labels: | + org.opencontainers.image.source=${{ github.event.repository.html_url }} + org.opencontainers.image.created=${{ steps.prep.outputs.created }} + org.opencontainers.image.revision=${{ github.sha }} -- cgit v1.2.3-70-g09d2