[WIP] add github workflow build #12
Workflow file for this run
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
| name: build | |
| on: | |
| schedule: | |
| # build every day at midnight | |
| - cron: '0 0 * * *' | |
| push: | |
| pull_request: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| jobs: | |
| webdevops-toolbox-latest: | |
| runs-on: ubuntu-latest | |
| # container: webdevops/dockerfile-build-env # not needed and way faster if not used | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-qemu-action@v3 | |
| - uses: docker/setup-buildx-action@v3 | |
| - | |
| if: github.ref == 'refs/heads/github-actions' | |
| name: Login to ghcr.io | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - | |
| if: github.ref == 'refs/heads/github-actions' | |
| name: Login to hub.docker.com | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - | |
| name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: docker/toolbox/latest | |
| push: ${{ github.ref == 'refs/heads/github-actions' }} | |
| tags: ghcr.io/webdevops/toolbox:latest,webdevops/toolbox:latest | |
| platforms: linux/amd64,linux/arm64 | |
| webdevops-bootstrap-alpine: | |
| needs: ['webdevops-toolbox-latest'] | |
| runs-on: ubuntu-latest | |
| container: webdevops/dockerfile-build-env | |
| strategy: | |
| matrix: | |
| platform: [ linux/amd64, linux/arm64 ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-qemu-action@v3 | |
| - uses: docker/setup-buildx-action@v3 | |
| - | |
| if: github.ref == 'refs/heads/github-actions' | |
| name: Login to ghcr.io | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - | |
| if: github.ref == 'refs/heads/github-actions' | |
| name: Login to hub.docker.com | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - | |
| name: Build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: docker/bootstrap/alpine | |
| load: true | |
| tags: webdevops/bootstrap:alpine | |
| platforms: ${{ matrix.platform }} | |
| - name: run serverspec | |
| run: | | |
| cd tests/serverspec | |
| echo "FROM webdevops/bootstrap:alpine" >> Dockerfile_696e41bf715e49.28746787 | |
| echo "COPY conf/ /" >> Dockerfile_696e41bf715e49.28746787 | |
| bundle install | |
| bash serverspec.sh spec/docker/bootstrap_spec.rb webdevops/bootstrap:alpine eyJET0NLRVJfSU1BR0UiOiJ3ZWJkZXZvcHNcL2Jvb3RzdHJhcDphbHBpbmUiLCJET0NLRVJfVEFHIjoiYWxwaW5lIiwiT1NfRkFNSUxZIjoiYWxwaW5lIiwiT1NfVkVSU0lPTiI6IiIsIkRPQ0tFUkZJTEUiOiJEb2NrZXJmaWxlXzY5NmU0MWJmNzE1ZTQ5LjI4NzQ2Nzg3In0= Dockerfile_696e41bf715e49.28746787 | |
| - name: run structure-test | |
| run: | | |
| cd tests/structure-test | |
| /usr/local/bin/container-structure-test test --image webdevops/bootstrap:alpine --config bootstrap/test.yaml --config bootstrap/alpine/test.yaml | |
| - | |
| if: github.ref == 'refs/heads/github-actions' | |
| name: push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: docker/bootstrap/alpine | |
| push: true | |
| tags: ghcr.io/webdevops/bootstrap:alpine,webdevops/bootstrap:alpine | |
| platforms: ${{ matrix.platform }} | |
| webdevops-base-alpine: | |
| needs: ['webdevops-bootstrap-alpine'] | |
| runs-on: ubuntu-latest | |
| container: webdevops/dockerfile-build-env | |
| strategy: | |
| matrix: | |
| platform: [ linux/amd64, linux/arm64 ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-qemu-action@v3 | |
| - uses: docker/setup-buildx-action@v3 | |
| - | |
| if: github.ref == 'refs/heads/github-actions' | |
| name: Login to ghcr.io | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - | |
| if: github.ref == 'refs/heads/github-actions' | |
| name: Login to hub.docker.com | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - | |
| name: Build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: docker/base/alpine | |
| load: true | |
| tags: webdevops/base:alpine | |
| platforms: ${{ matrix.platform }} | |
| - name: run serverspec | |
| run: | | |
| cd tests/serverspec | |
| echo "FROM webdevops/base:alpine" >> Dockerfile_696e41bf7160e6.29634751 | |
| echo "COPY conf/ /" >> Dockerfile_696e41bf7160e6.29634751 | |
| bundle install | |
| bash serverspec.sh spec/docker/base_spec.rb webdevops/base:alpine eyJET0NLRVJfSU1BR0UiOiJ3ZWJkZXZvcHNcL2Jhc2U6YWxwaW5lIiwiRE9DS0VSX1RBRyI6ImFscGluZSIsIk9TX0ZBTUlMWSI6ImFscGluZSIsIk9TX1ZFUlNJT04iOiIiLCJET0NLRVJGSUxFIjoiRG9ja2VyZmlsZV82OTZlNDFiZjcxNjBlNi4yOTYzNDc1MSJ9 Dockerfile_696e41bf7160e6.29634751 | |
| - name: run structure-test | |
| run: | | |
| cd tests/structure-test | |
| /usr/local/bin/container-structure-test test --image webdevops/base:alpine --config base/test.yaml --config base/alpine/test.yaml | |
| - | |
| if: github.ref == 'refs/heads/github-actions' | |
| name: push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: docker/bootstrap/alpine | |
| push: true | |
| tags: ghcr.io/webdevops/base:alpine,webdevops/base:alpine | |
| platforms: ${{ matrix.platform }} | |
| webdevops-apache-alpine: | |
| needs: ['webdevops-base-alpine'] | |
| runs-on: ubuntu-latest | |
| container: webdevops/dockerfile-build-env | |
| strategy: | |
| matrix: | |
| platform: [ linux/amd64, linux/arm64 ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-qemu-action@v3 | |
| - uses: docker/setup-buildx-action@v3 | |
| - | |
| if: github.ref == 'refs/heads/github-actions' | |
| name: Login to ghcr.io | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - | |
| if: github.ref == 'refs/heads/github-actions' | |
| name: Login to hub.docker.com | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - | |
| name: Build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: docker/apache/alpine | |
| load: true | |
| tags: webdevops/apache:alpine | |
| platforms: ${{ matrix.platform }} | |
| - name: run serverspec | |
| run: | | |
| cd tests/serverspec | |
| echo "FROM webdevops/apache:alpine" >> Dockerfile_696e41bf7162b9.73549954 | |
| echo "COPY conf/ /" >> Dockerfile_696e41bf7162b9.73549954 | |
| bundle install | |
| bash serverspec.sh spec/docker/apache_spec.rb webdevops/apache:alpine eyJET0NLRVJfSU1BR0UiOiJ3ZWJkZXZvcHNcL2FwYWNoZTphbHBpbmUiLCJET0NLRVJfVEFHIjoiYWxwaW5lIiwiT1NfRkFNSUxZIjoiYWxwaW5lIiwiT1NfVkVSU0lPTiI6IiIsIkRPQ0tFUkZJTEUiOiJEb2NrZXJmaWxlXzY5NmU0MWJmNzE2MmI5LjczNTQ5OTU0In0= Dockerfile_696e41bf7162b9.73549954 | |
| - | |
| if: github.ref == 'refs/heads/github-actions' | |
| name: push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: docker/bootstrap/alpine | |
| push: true | |
| tags: ghcr.io/webdevops/apache:alpine,webdevops/apache:alpine | |
| platforms: ${{ matrix.platform }} |