-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from mjanez/main
Improve Dockerfiles
- Loading branch information
Showing
11 changed files
with
268 additions
and
63 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- latest | ||
tags: | ||
- 'v*.*.*' | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Login to registry | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Build and release image manually | ||
|
||
on: workflow_dispatch | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
CONTEXT: . | ||
BRANCH: ${{ github.ref_name }} | ||
DOCKERFILE_PATH: /ckan-mqa | ||
DOCKERFILE: Dockerfile | ||
|
||
jobs: | ||
docker: | ||
name: manual/build-docker-push:${{ github.ref_name }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login to registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
labels: | | ||
org.opencontainers.image.documentation=https://github.com/${{ github.repository }}/blob/${{ env.BRANCH }}/README.md | ||
org.opencontainers.image.version=${{ env.BRANCH }} | ||
- name: Replace slashes in BRANCH to avoid errors | ||
run: echo "BRANCH=${BRANCH////_}" >> $GITHUB_ENV | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BRANCH }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
context: ${{ env.CONTEXT }} | ||
file: ${{ env.CONTEXT }}${{ env.DOCKERFILE_PATH }}/${{ env.DOCKERFILE }} | ||
|
||
- name: Linting Dockerfile with hadolint in GH Actions | ||
uses: hadolint/hadolint-action@v3.1.0 | ||
with: | ||
dockerfile: ${{ env.CONTEXT }}${{ env.DOCKERFILE_PATH }}/${{ env.DOCKERFILE }} | ||
no-fail: true | ||
|
||
- name: Run Trivy container image vulnerability scanner | ||
uses: aquasecurity/trivy-action@0.17.0 | ||
with: | ||
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BRANCH }} | ||
format: sarif | ||
output: trivy-results.sarif | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v3 | ||
if: always() | ||
with: | ||
sarif_file: trivy-results.sarif |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Test ckan-mqa images (PR) | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
- 'ckan-mqa-*.*.*' | ||
- '!dev/ckan-mqa-*.*.*' | ||
- '!feature/*' | ||
- '!fix/*' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ckan-mqa | ||
CONTEXT: . | ||
BRANCH: ${{ github.head_ref }} | ||
DOCKERFILE_PATH: /ckan-mqa | ||
DOCKERFILE: Dockerfile | ||
HADOLINT_VERSION: 2.12.0 | ||
|
||
jobs: | ||
docker: | ||
name: runner/test-ckan-mqa-pr:${{ github.head_ref }} | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' | ||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Linting Dockerfiles and annotate code inline in the github PR viewer | ||
id: hadolint | ||
uses: jbergstroem/hadolint-gh-action@v1.12.2 | ||
with: | ||
dockerfile: ${{ env.CONTEXT }}${{ env.DOCKERFILE_PATH }}/${{ env.DOCKERFILE }} | ||
version: ${{ env.HADOLINT_VERSION }} | ||
annotate: true | ||
error_level: -1 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,83 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- latest | ||
tags: | ||
- 'v*.*.*' | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Login to registry | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
name: Build and push ckan-mqa image from PR Merge | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
branches: | ||
- master | ||
- 'ckan-mqa-*.*.*' | ||
- '!dev/ckan-mqa-*.*.*' | ||
- '!feature/*' | ||
- '!fix/*' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
CONTEXT: . | ||
BRANCH: ${{ github.head_ref }} | ||
DOCKERFILE_PATH: /ckan-mqa | ||
DOCKERFILE: Dockerfile | ||
|
||
jobs: | ||
docker: | ||
name: runner/build-docker-push:${{ github.head_ref }} | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == true | ||
|
||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login to registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
labels: | | ||
org.opencontainers.image.documentation=https://github.com/${{ github.repository }}/blob/${{ env.BRANCH }}/README.md | ||
org.opencontainers.image.version=${{ env.BRANCH }} | ||
- name: Replace slashes in BRANCH to avoid errors | ||
run: echo "BRANCH=${BRANCH////_}" >> $GITHUB_ENV | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:${{ github.head_ref }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
context: ${{ env.CONTEXT }} | ||
file: ${{ env.CONTEXT }}${{ env.DOCKERFILE_PATH }}/${{ env.DOCKERFILE }} | ||
|
||
- name: Linting Dockerfile with hadolint in GH Actions | ||
uses: hadolint/hadolint-action@v3.1.0 | ||
with: | ||
dockerfile: ${{ env.CONTEXT }}${{ env.DOCKERFILE_PATH }}/${{ env.DOCKERFILE }} | ||
no-fail: true | ||
|
||
- name: Run Trivy container image vulnerability scanner | ||
uses: aquasecurity/trivy-action@0.12.0 | ||
with: | ||
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BRANCH }} | ||
format: sarif | ||
output: trivy-results.sarif | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v3 | ||
if: always() | ||
with: | ||
sarif_file: trivy-results.sarif |
This file contains 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
This file contains 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
File renamed without changes.
File renamed without changes.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Log folder | ||
This folder is used to store logs generated by `ckan2pycsw` script and `catalog.rdf` file downloaded from URL. Logs are essential for debugging and tracing the execution of the code. By keeping logs, you can track the behavior of your code over time, identify errors and performance issues, and improve the overall quality of your code. | ||
This folder is used to store logs generated by `ckan2pycsw` script and `catalog.rdf` file downloaded from `CKAN_CATALOG_URL`. Logs are essential for debugging and tracing the execution of the code. By keeping logs, you can track the behavior of your code over time, identify errors and performance issues, and improve the overall quality of your code. |