Skip to content

Commit 42e762e

Browse files
committed
added ghrc workflow
1 parent 872f361 commit 42e762e

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

.github/workflows/ghrc.yml

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

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# syntax=docker/dockerfile:1
22
FROM ubuntu:22.04
3+
LABEL org.opencontainers.image.source=https://github.com/Dpbm/snake-ai
34

45
ENV TZ "America/New_York"
56
ENV DEBIAN_FRONTEND noninteractive

0 commit comments

Comments
 (0)