Skip to content

Commit

Permalink
Pin image to hash, enable dependabot for images (#300)
Browse files Browse the repository at this point in the history
* Rename to Dockerfile

* Pin to hash

* Add dependabot

* Include tag for clarity
  • Loading branch information
keiranjprice101 authored Aug 13, 2024
1 parent 14ad59a commit 3cc3276
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,12 @@ updates:
action-packages:
patterns:
- "*"

- package-ecosystem: "docker"
directory: "/container"
schedule:
interval: "daily"
groups:
docker:
patterns:
- "*"
8 changes: 4 additions & 4 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ jobs:
id: docker_build
uses: docker/build-push-action@v6
with:
file: ./container/rundetection.D
file: ./container/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/rundetection:${{ github.sha }}

- name: Checkout the Gitops repository
uses: actions/checkout@v4
with:
repository: fiaisis/gitops
token: ${{ secrets.GITOPS_STAGING_EDIT_TOKEN }}

- name: Edit the YAML rundetection file for staging
uses: mikefarah/[email protected]
with:
cmd: yq e -i '.spec.template.spec.containers[] |= select(.name == "rundetection").image = "ghcr.io/fiaisis/rundetection@${{ steps.docker_build.outputs.digest }}"' './components/rundetection/envs/staging/rundetection.yml'

- name: Commit and push changes
run: |
git config --local user.email "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Build run-detection Docker image
uses: docker/build-push-action@v6
with:
file: ./container/rundetection.D
file: ./container/Dockerfile
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/rundetection:${{ github.sha }}

- name: Run Trivy vulnerability scanner
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ localhost will be used as the default host, and the default credentials, guest g
- Construct the container by running:

```shell
docker build . -f ./container/rundetection.D -t ghcr.io/fiaisis/rundetection
docker build . -f ./container/Dockerfile -t ghcr.io/fiaisis/rundetection
```

- Run the container by running:
Expand Down
2 changes: 1 addition & 1 deletion container/rundetection.D → container/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12-slim
FROM python:3.12-slim@sha256:740d94a19218c8dd584b92f804b1158f85b0d241e5215ea26ed2dcade2b9d138

# Install run-detection to the container
ADD . .
Expand Down
2 changes: 1 addition & 1 deletion test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
run-detection:
build:
context: ../
dockerfile: container/rundetection.D
dockerfile: container/Dockerfile
depends_on:
rabbit-mq:
condition: service_healthy
Expand Down

0 comments on commit 3cc3276

Please sign in to comment.