Added images build CI
This commit is contained in:
parent
a5b006f728
commit
189a3c4e0c
73
.gitea/workflows/docker-build.yml
Normal file
73
.gitea/workflows/docker-build.yml
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
name: Build and Push Docker Images
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- 'images/base/**'
|
||||||
|
- 'images/jupyter/**'
|
||||||
|
tags:
|
||||||
|
- 'v*.*.*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: registry.bouvais.lu
|
||||||
|
BASE_IMAGE_NAME: something/base
|
||||||
|
JUPYTER_IMAGE_NAME: something/jupyter
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
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: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
# --- 1. BUILD BASE IMAGE ---
|
||||||
|
- name: Extract metadata for Base
|
||||||
|
id: meta-base
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
type=ref,event=branch
|
||||||
|
type=sha,format=short
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
|
||||||
|
- name: Build and push Base image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ./images/base
|
||||||
|
# Note: Linux is case-sensitive. If your file is literally lowercase "dockerfile", change this to "dockerfile"
|
||||||
|
file: ./images/base/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta-base.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta-base.outputs.labels }}
|
||||||
|
|
||||||
|
# --- 2. BUILD JUPYTER IMAGE ---
|
||||||
|
- name: Extract metadata for Jupyter
|
||||||
|
id: meta-jupyter
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.JUPYTER_IMAGE_NAME }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
type=ref,event=branch
|
||||||
|
type=sha,format=short
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
|
||||||
|
- name: Build and push Jupyter image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ./images/jupyter
|
||||||
|
file: ./images/jupyter/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta-jupyter.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta-jupyter.outputs.labels }}
|
||||||
Loading…
x
Reference in New Issue
Block a user