NOISSUE - Create and publish a Docker image (#29)

* Create and publish a Docker image

This commit adds a new file `.github/workflows/build.yml` which contains the workflow configuration for creating and publishing a Docker image. The workflow is triggered on push events to the `main` branch. It sets environment variables for the registry and image name. The job runs on `ubuntu-latest` and has necessary permissions for reading contents and writing packages. The steps include checking out the repository, logging in to the container registry using the GitHub token, and extracting metadata for Docker.

Signed-off-by: SammyOina <sammyoina@gmail.com>

* Refactor build workflow and update Makefile

The build workflow has been refactored to build the Manager image instead of the API Gateway image. The Makefile has also been updated.

The changes include:
- Renaming the build step to "Build Manager and push Docker image"
- Updating the image name to include "/manager"
- Updating the build arguments to use "SVC=manager"
- Updating the tags to use the output from the metadata action

These changes ensure that the correct Docker image is built and pushed.

Signed-off-by: SammyOina <sammyoina@gmail.com>

* remove labels

Signed-off-by: SammyOina <sammyoina@gmail.com>

---------

Signed-off-by: SammyOina <sammyoina@gmail.com>
This commit is contained in:
Sammy Kerata Oina
2023-12-21 19:26:34 +03:00
committed by GitHub
parent 3e7fc09233
commit 668552256f
3 changed files with 51 additions and 3 deletions
+47
View File
@@ -0,0 +1,47 @@
# Copyright (c) Ultraviolet
# SPDX-License-Identifier: Apache-2.0
name: Create and publish a Docker image
on:
push:
branches: ["main"]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/manager
- name: Build Manager and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
push: true
build-args: |
SVC=manager
tags: ${{ steps.meta.outputs.tags }}