From ea6ec33528b1396b319c88b7558562d1105d6457 Mon Sep 17 00:00:00 2001 From: VillSource <30929839+VillSource@users.noreply.github.com> Date: Sat, 2 Mar 2024 04:38:45 +0700 Subject: [PATCH 1/2] publish image to ghcr with action --- .github/workflows/publish.yml | 25 +++++++++++++++++++++++++ src/PictureStorageService/Dockerfile | 1 + 2 files changed, 26 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..bdda24d --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,25 @@ + +name: Publish Image to GHCR +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + publish-image: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build the Docker image + run: | + docker build -f ./src/PictureStorageService/Dockerfile . --tag ghcr.io/untitlecms/src/picture-storage-service:v0 + docker push ghcr.io/untitlecms/picture-storage-service:v0 diff --git a/src/PictureStorageService/Dockerfile b/src/PictureStorageService/Dockerfile index de4c9a3..6446953 100644 --- a/src/PictureStorageService/Dockerfile +++ b/src/PictureStorageService/Dockerfile @@ -1,6 +1,7 @@ #See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base +LABEL org.opencontainers.image.source = "https://github.com/UntitleCMS/PictureStorageService" WORKDIR /app EXPOSE 80 From 2dee4588f059c2144f0e7fa0eb7a24fff307b4c2 Mon Sep 17 00:00:00 2001 From: VillSource <30929839+VillSource@users.noreply.github.com> Date: Sat, 2 Mar 2024 04:40:31 +0700 Subject: [PATCH 2/2] Update publish.yml --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bdda24d..32ee0cc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,5 +21,5 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build the Docker image run: | - docker build -f ./src/PictureStorageService/Dockerfile . --tag ghcr.io/untitlecms/src/picture-storage-service:v0 + docker build -f ./src/PictureStorageService/Dockerfile . --tag ghcr.io/untitlecms/picture-storage-service:v0 docker push ghcr.io/untitlecms/picture-storage-service:v0