-
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 #2 from jembi/CU-86c0zbfdg_dockerise_mediator
Cu 86c0zbfdg dockerise mediator
- Loading branch information
Showing
5 changed files
with
121 additions
and
12 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,47 @@ | ||
name: Build & Push Climate Mediator image | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*.*.*" | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-push: | ||
environment: dockerhub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- run: npm run build | ||
|
||
- name: Build and push tag | ||
if: ${{ github.ref_name != 'main' }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: jembi/climate-mediator:${{ github.ref_name }} | ||
|
||
- name: Build and push latest | ||
if: ${{ github.ref_name == 'main' }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: jembi/climate-mediator:latest | ||
|
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,30 @@ | ||
name: Scan latest climate mediator image | ||
|
||
on: | ||
schedule: | ||
- cron: '0 5 * * *' | ||
|
||
jobs: | ||
scan-images: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build an image from Dockerfile | ||
run: | | ||
docker build -t jembi/climate-mediator:${{ github.sha }} . | ||
- name: Run trivy vulnerability scanner for the climate mediator image | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: jembi/climate-mediator:${{ github.sha }} | ||
format: 'sarif' | ||
output: 'trivy-results.sarif' | ||
|
||
- name: Upload Trivy scan results to Github Security tab | ||
uses: github/codeql-action/upload-sarif@v2 | ||
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,14 @@ | ||
name: Run Climate Mediator Tests | ||
on: push | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install modules | ||
run: npm i | ||
|
||
- name: Run tests | ||
run: npm run test | ||
|
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,12 @@ | ||
FROM node:16-alpine | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
|
||
RUN npm run build | ||
|
||
|
||
EXPOSE 3000 | ||
|
||
CMD [ "node", "dist/index.js" ] |
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