Skip to content

Commit 7227b5a

Browse files
authored
Merge pull request #514 from sparcs-kaist/512-ghcr-cd-migrate
512 ghcr cd migrate
2 parents abe0ea9 + 4bbef5b commit 7227b5a

File tree

2 files changed

+71
-64
lines changed

2 files changed

+71
-64
lines changed

.github/workflows/cd-prod.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Push Prod Image to GHCR
2+
permissions:
3+
contents: read
4+
packages: write
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
publish-docker-image:
13+
name: Build and Push
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
fail-fast: true
18+
matrix:
19+
include:
20+
- dockerfile: ./.docker/web.Dockerfile
21+
image: ghcr.io/sparcs/biseo-web
22+
- dockerfile: ./.docker/api.Dockerfile
23+
image: ghcr.io/sparcs/biseo-api
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Cache Docker Layers
33+
uses: actions/cache@v3
34+
with:
35+
path: /tmp/.buildx-cache
36+
key: ${{ runner.os }}-buildx-${{ github.sha }}
37+
restore-keys: |
38+
${{ runner.os }}-buildx-
39+
40+
- name: Log in to Github Container Registry
41+
uses: docker/login-action@v3
42+
with:
43+
registry: "ghcr.io"
44+
username: ${{ github.actor }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Extract Metadata
48+
id: meta
49+
uses: docker/metadata-action@v5
50+
with:
51+
images: ${{ matrix.image }}
52+
tags: |
53+
type=raw,value=latest
54+
type=sha,format=long
55+
56+
- name: Build and push Docker image
57+
uses: docker/build-push-action@v5
58+
with:
59+
context: .
60+
file: ${{ matrix.dockerfile }}
61+
push: true
62+
tags: ${{ steps.meta.outputs.tags }}
63+
labels: ${{ steps.meta.outputs.labels }}
64+
cache-from: type=local,src=/tmp/.buildx-cache
65+
cache-to: type=local,dest=/tmp/.buildx-cache-new
66+
67+
- name: Move cache
68+
run: |
69+
rm -rf /tmp/.buildx-cache
70+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
71+

.github/workflows/push_image_ecr.yml

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)