Skip to content

Commit 314cb94

Browse files
committed
Updating docker build to better tagging
1 parent 91d46e9 commit 314cb94

File tree

2 files changed

+39
-46
lines changed

2 files changed

+39
-46
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
---
12
version: 2
23
updates:
34
# Docker dependencies (base image updates)
4-
- package-ecosystem: "docker"
5-
directory: "/" # Root path where your Dockerfile lives
5+
- package-ecosystem: docker
6+
directory: / # Root path where your Dockerfile lives
67
schedule:
7-
interval: "weekly"
8+
interval: weekly
89

910
# GitHub Actions dependencies (action version updates)
10-
- package-ecosystem: "github-actions"
11-
directory: ".github/workflows"
11+
- package-ecosystem: github-actions
12+
directory: .github/workflows
1213
schedule:
13-
interval: "weekly"
14+
interval: weekly
Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,33 @@
11
---
2-
name: Build and Push Docker Image
3-
4-
on:
5-
push:
6-
branches: [main]
7-
workflow_dispatch:
8-
9-
permissions:
10-
contents: read
11-
packages: write
12-
13-
jobs:
14-
build-and-push-docker-image:
15-
runs-on: ubuntu-latest
16-
steps:
17-
- name: Checkout repository
18-
uses: actions/checkout@v4
19-
20-
- name: Set up Docker Buildx
21-
uses: docker/setup-buildx-action@v3
22-
23-
- name: Log in to GitHub Container Registry
24-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
25-
26-
- name: Extract version from pyproject.toml
27-
id: get_version
28-
run: |
29-
VERSION=$(grep '^current_version' pyproject.toml | head -n 1 | cut -d '"' -f2)
30-
echo "VERSION=$VERSION" >> $GITHUB_ENV
31-
32-
- name: Build and push Docker image
33-
run: |
34-
docker buildx build \
35-
--push \
36-
--tag ghcr.io/${{ github.repository }}:latest \
37-
--tag ghcr.io/${{ github.repository }}:${{ github.sha }} \
38-
--tag ghcr.io/${{ github.repository }}:${{ env.VERSION }} \
39-
.
40-
41-
2+
name: Build and Push Docker Image
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
permissions:
8+
contents: read
9+
packages: write
10+
jobs:
11+
build-and-push-docker-image:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v3
18+
- name: Log in to GitHub Container Registry
19+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }}
20+
--password-stdin
21+
- name: Extract version from pyproject.toml
22+
id: get_version
23+
run: |
24+
VERSION=$(grep '^current_version' pyproject.toml | head -n 1 | cut -d '"' -f2)
25+
echo "VERSION=$VERSION" >> $GITHUB_ENV
26+
- name: Build and push Docker image
27+
run: |
28+
docker buildx build \
29+
--push \
30+
--tag ghcr.io/${{ github.repository }}:latest \
31+
--tag ghcr.io/${{ github.repository }}:${{ github.sha }} \
32+
--tag ghcr.io/${{ github.repository }}:${{ env.VERSION }} \
33+
.

0 commit comments

Comments
 (0)