Skip to content

Commit d5df742

Browse files
committed
Added pipeline
1 parent 4da0555 commit d5df742

2 files changed

Lines changed: 50 additions & 4 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build and Publish Docker Image
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
workflow_dispatch:
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Log in to the Container registry
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Extract metadata (tags, labels) for Docker
34+
id: meta
35+
uses: docker/metadata-action@v5
36+
with:
37+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38+
tags: |
39+
type=raw,value=latest,enable={{is_default_branch}}
40+
type=sha
41+
42+
- name: Build and push Docker image
43+
uses: docker/build-push-action@v5
44+
with:
45+
context: .
46+
push: true
47+
tags: ${{ steps.meta.outputs.tags }}
48+
labels: ${{ steps.meta.outputs.labels }}

docker-compose.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ version: '3'
22

33
services:
44
gh-runner:
5-
pull_policy: build
5+
image: ghcr.io/hackucf/docker-gh-runner:latest
6+
pull_policy: always
67
restart: always
7-
build:
8-
context: ./
9-
dockerfile: Dockerfile
108
environment:
119
ORGANIZATION: ${GITHUB_ORG}
1210
ACCESS_TOKEN: ${GITHUB_ACCESS_TOKEN}

0 commit comments

Comments
 (0)