Skip to content

Commit a2eb755

Browse files
Merge branch 'main' of github.com:openagri-eu/OpenAgri-UserDashboard
2 parents a2c7f7a + e874884 commit a2eb755

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
inputs:
8+
branch:
9+
description: 'Branch to run the workflow on'
10+
required: false
11+
release:
12+
types:
13+
- created
14+
15+
jobs:
16+
build-and-push:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0 # Saves time by not fetching other branches
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Login to GitHub Container Registry
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.repository_owner }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Set lowercase repository name
39+
run: |
40+
echo "REPO_LOWER=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
41+
42+
- name: Build and push Docker image
43+
id: docker_build
44+
uses: docker/build-push-action@v6
45+
with:
46+
context: .
47+
push: true
48+
tags: ghcr.io/${{ env.REPO_LOWER }}:latest
49+
cache-from: type=gha
50+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)