From 6df52026de63445e76091d6f68e49be3789f8238 Mon Sep 17 00:00:00 2001 From: Umberto Villa Date: Thu, 2 May 2024 11:50:45 -0500 Subject: [PATCH] Build me --- .github/workflows/docker-ls6.yaml | 70 +++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/docker-ls6.yaml diff --git a/.github/workflows/docker-ls6.yaml b/.github/workflows/docker-ls6.yaml new file mode 100644 index 000000000..4e96a8bc8 --- /dev/null +++ b/.github/workflows/docker-ls6.yaml @@ -0,0 +1,70 @@ +name: ls6image +on: + push: + branches: + - main + pull_request: + +jobs: + docker-ci: + runs-on: ubuntu-latest + name: "docker ls6 env" + env: + DOCKERPATH: docker/ls6 + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.11.0 + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: Ana06/get-changed-files@v2.2.0 + id: files + - name: Dockerpath configuration + run: echo "DOCKERPATH=$DOCKERPATH" + - name: Dockerpath - check if files in docker path changed + if: contains(steps.files.outputs.all,env.DOCKERPATH) || contains(steps.files.outputs.all,'docker-ls6.yaml') + run: | + echo "CI container needs rebuilding..." + echo "CI_NEEDS_REBUILD=true" >> $GITHUB_ENV + - name: Docker Image - Set up QEMU + if: env.CI_NEEDS_REBUILD + uses: docker/setup-qemu-action@v2 + - name: Docker Image - Setup Buildx + if: env.CI_NEEDS_REBUILD + uses: docker/setup-buildx-action@v2 + - name: Docker Image - Dockerhub login + if: env.CI_NEEDS_REBUILD + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + if: env.CI_NEEDS_REBUILD + uses: docker/metadata-action@v4 + with: + images: pecosut/tps_ls6 + tags: type=sha + flavor: latest=true + - name: Build Container motd + if: env.CI_NEEDS_REBUILD + run: | + echo "#!/bin/bash" > ${{env.DOCKERPATH}}/motd.sh + echo "echo --------------------------------" >> ${{env.DOCKERPATH}}/motd.sh + echo "echo TPS/ls6 Development Container" >> ${{env.DOCKERPATH}}/motd.sh + echo "echo \"Revision: `echo ${GITHUB_SHA} | cut -c1-8`\"" >> ${{env.DOCKERPATH}}/motd.sh + echo "echo --------------------------------" >> ${{env.DOCKERPATH}}/motd.sh + chmod 755 ${{env.DOCKERPATH}}/motd.sh + cat ${{env.DOCKERPATH}}/motd.sh + - name: Docker Image - Build and push + if: env.CI_NEEDS_REBUILD + uses: docker/build-push-action@v3 + with: + push: true + context: ${{ env.DOCKERPATH }} + tags: ${{ steps.meta.outputs.tags }} + - name: Docker Image - modules avail + if: env.CI_NEEDS_REBUILD + run: docker ps