diff --git a/.github/workflows/build-latest-container-images.yaml b/.github/workflows/build-latest-container-images.yaml new file mode 100644 index 0000000..3e62bf9 --- /dev/null +++ b/.github/workflows/build-latest-container-images.yaml @@ -0,0 +1,108 @@ +name: Publish Latest Container Images +on: + push: + tags: + - '5.*' + +jobs: + lint_dockerfiles: + name: Lint Dockerfile with hadolint + runs-on: ubuntu-latest + strategy: + matrix: + dockerfile: + - 5.0/apache/Dockerfile + - 5.0/fpm-alpine/Dockerfile + - 5.0/fpm/Dockerfile + steps: + - uses: actions/checkout@v2 + - uses: hadolint/hadolint-action@v1.5.0 + with: + dockerfile: ${{ matrix.dockerfile }} + ignore: DL4006 DL3008 DL3018 + + push_images_to_registries: + name: Push Container Images to registries + runs-on: ubuntu-latest + needs: [lint_dockerfiles] + environment: docker-build + permissions: + packages: write + contents: read + steps: + - name: 'Check out the repo' + uses: actions/checkout@v2 + - name: 'Set up Docker Buildx' + uses: docker/setup-buildx-action@v1 + with: + buildkitd-flags: --debug + - name: 'Log in to DockerHub' + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} + ## Can be enabled in the future + # - name: Log in to GitHub Container Registry + # uses: docker/login-action@v1 + # with: + # registry: gchr.io + # username: ${{ github.repository_owner }} + # password: ${{ secrets.GITHUB_TOKEN }} + - name: 'Apache variant metadata' + id: metadata-apache + uses: docker/metadata-action@v3 + with: + images: | + docker.io/martialblog/limesurvey + ## Can be enabled in the future + # ghcr.io/martialblog/limesurvey + tags: | + type=semver,pattern={{raw}},suffix=-apache + type=semver,pattern={{major}},suffix=-apache + flavor: | + latest=false + - name: 'Build and push latest Apache container images' + uses: docker/build-push-action@v2 + with: + context: 5.0/apache + push: true + tags: ${{ steps.metadata-apache.outputs.tags }} + labels: ${{ steps.metadata-apache.outputs.labels }} + + - name: 'FPM variant metadata' + id: metadata-fpm + uses: docker/metadata-action@v3 + with: + images: | + docker.io/martialblog/limesurvey + # ghcr.io/martialblog/limesurvey + tags: | + type=semver,pattern={{version}},suffix=-fpm + type=semver,pattern={{major}},suffix=-fpm + - name: 'Build and push latest fpm container images' + uses: docker/build-push-action@v2 + with: + context: 5.0/fpm + push: true + tags: ${{ steps.metadata-fpm.outputs.tags }} + labels: ${{ steps.metadata-apache.outputs.labels }} + + - name: 'FPM Alpine variant metadata' + id: metadata-fpm-alpine + uses: docker/metadata-action@v3 + with: + images: | + docker.io/martialblog/limesurvey + ## Can be enabled in the future + # ghcr.io/martialblog/limesurvey + tags: | + type=semver,pattern={{version}},suffix=-fpm-alpine + type=semver,pattern={{major}},suffix=-fpm-alpine + - name: 'Build and push latest fpm-alpine container images' + uses: docker/build-push-action@v2 + with: + context: 5.0/fpm-alpine + push: true + tags: ${{ steps.metadata-fpm-alpine.outputs.tags }} + labels: ${{ steps.metadata-apache.outputs.labels }} diff --git a/.github/workflows/build-lts-container-images.yaml b/.github/workflows/build-lts-container-images.yaml new file mode 100644 index 0000000..3ddf6c6 --- /dev/null +++ b/.github/workflows/build-lts-container-images.yaml @@ -0,0 +1,110 @@ +name: Publish LTS Container Images +on: + push: + tags: + - '3.*' + +jobs: + lint_dockerfiles: + name: 'Lint Dockerfile with hadolint' + runs-on: ubuntu-latest + strategy: + matrix: + dockerfile: + - 3.0/apache/Dockerfile + - 3.0/fpm-alpine/Dockerfile + - 3.0/fpm/Dockerfile + steps: + - uses: actions/checkout@v2 + - uses: hadolint/hadolint-action@v1.5.0 + with: + dockerfile: ${{ matrix.dockerfile }} + ignore: DL4006 DL3008 DL3018 + + push_images_to_registries: + name: 'Push container images to registries' + runs-on: ubuntu-latest + needs: [lint_dockerfiles] + environment: docker-build + permissions: + packages: write + contents: read + steps: + - name: 'Check out the repo' + uses: actions/checkout@v2 + - name: 'Set up Docker Buildx' + uses: docker/setup-buildx-action@v1 + with: + buildkitd-flags: --debug + - name: 'Log in to DockerHub' + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} + ## Can be enabled in the future + # - name: Log in to GitHub Container Registry + # uses: docker/login-action@v1 + # with: + # registry: gchr.io + # username: ${{ github.repository_owner }} + # password: ${{ secrets.GITHUB_TOKEN }} + + - name: 'Apache variant metadata' + id: metadata-apache + uses: docker/metadata-action@v3 + with: + images: | + docker.io/martialblog/limesurvey + ## Can be enabled in the future + # ghcr.io/martialblog/limesurvey + tags: | + type=semver,pattern={{raw}},suffix=-apache + type=semver,pattern={{major}},suffix=-apache + flavor: | + latest=false + - name: 'Build and push LTS apache container images' + uses: docker/build-push-action@v2 + with: + context: 3.0/apache + push: true + tags: ${{ steps.metadata-apache.outputs.tags }} + labels: ${{ steps.metadata-apache.outputs.labels }} + + - name: 'FPM variant metadata' + id: metadata-fpm + uses: docker/metadata-action@v3 + with: + images: | + docker.io/martialblog/limesurvey + ## Can be enabled in the future + # ghcr.io/martialblog/limesurvey + tags: | + type=semver,pattern={{version}},suffix=-fpm + type=semver,pattern={{major}},suffix=-fpm + - name: 'Build and push LTS fpm container images' + uses: docker/build-push-action@v2 + with: + context: 3.0/fpm + push: true + tags: ${{ steps.metadata-fpm.outputs.tags }} + labels: ${{ steps.metadata-apache.outputs.labels }} + + - name: 'FPM Alpine variant metadata' + id: metadata-fpm-alpine + uses: docker/metadata-action@v3 + with: + images: | + docker.io/martialblog/limesurvey + ## Can be enabled in the future + # ghcr.io/martialblog/limesurvey + tags: | + type=semver,pattern={{version}},suffix=-fpm-alpine + type=semver,pattern={{major}},suffix=-fpm-alpine + - name: 'Build and push LTS fpm-alpine container images' + uses: docker/build-push-action@v2 + with: + context: 3.0/fpm-alpine + push: true + tags: ${{ steps.metadata-fpm-alpine.outputs.tags }} + labels: ${{ steps.metadata-apache.outputs.labels }} diff --git a/.github/workflows/lint-dockerfiles.yaml b/.github/workflows/lint-dockerfiles.yaml new file mode 100644 index 0000000..11c0d37 --- /dev/null +++ b/.github/workflows/lint-dockerfiles.yaml @@ -0,0 +1,24 @@ +--- +name: Lint Dockerfile + +on: [push, pull_request] + +jobs: + lint: + name: Lint Dockerfile with hadolint + strategy: + matrix: + dockerfile: + - 3.0/apache/Dockerfile + - 3.0/fpm-alpine/Dockerfile + - 3.0/fpm/Dockerfile + - 5.0/apache/Dockerfile + - 5.0/fpm-alpine/Dockerfile + - 5.0/fpm/Dockerfile + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: hadolint/hadolint-action@v1.5.0 + with: + dockerfile: ${{ matrix.dockerfile }} + ignore: DL4006 DL3008 DL3018 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a8964a0..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -sudo: required -language: bash -services: - - docker -install: -jobs: - include: - - env: HADOLINT="${HOME}/hadolint" - script: - - curl -sL -o ${HADOLINT} "https://github.com/hadolint/hadolint/releases/download/v1.23.0/hadolint-$(uname -s)-$(uname -m)" - - chmod 700 ${HADOLINT} - - git ls-files --exclude='Dockerfile*' --ignored | xargs --max-lines=1 ${HADOLINT} --ignore DL4006 --ignore DL3008 --ignore DL3018 - - env: TAG=martialblog/limesurvey-apache - script: cd 5.0/apache; docker build -q -t $TAG . && cd ../..; ./tests/run.sh $TAG - - env: TAG=martialblog/limesurvey-fpm - script: cd 5.0/fpm; docker build -q -t $TAG . && cd ../..; ./tests/run.sh $TAG - - env: TAG=martialblog/limesurvey-alpine - script: cd 5.0/fpm; docker build -q -t $TAG . && cd ../..; ./tests/run.sh $TAG