Compare commits
18
Commits
2fef740a5f
...
1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e8ebce721 | ||
|
|
756a781524 | ||
|
|
0ffe89a881 | ||
|
|
5287ca66a1 | ||
|
|
cb63016421 | ||
|
|
43802259ed | ||
|
|
c8046eb98f | ||
|
|
57d1335fba | ||
|
|
ea7ee88ce1 | ||
|
|
a20c7e2c59 | ||
|
|
6945db40e1 | ||
|
|
1d8cfbfc07 | ||
|
|
74da180a07 | ||
|
|
0aa9488627 | ||
|
|
2782d6d43d | ||
|
|
82cf6bf7e6 | ||
|
|
7662463c7d | ||
|
|
9ee2fd2837 |
@@ -2,72 +2,77 @@ 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
|
||||
BASE_IMAGE_NAME: tenant/base
|
||||
JUPYTER_IMAGE_NAME: tenant/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 }}
|
||||
run: |
|
||||
docker login ${{ env.REGISTRY }} \
|
||||
--username adrien \
|
||||
--password "${{ secrets.DOCKER_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}}
|
||||
# --- 1. BUILD & TEST BASE IMAGE ---
|
||||
- name: Build Base image
|
||||
run: |
|
||||
docker build \
|
||||
-f ./images/base/dockerfile \
|
||||
-t ${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}:${{ github.ref_name }} \
|
||||
./images/base
|
||||
|
||||
- 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 }}
|
||||
- name: Test Base image
|
||||
run: |
|
||||
cid=$(docker create -u root -w /tests ${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}:${{ github.ref_name }} sleep 60)
|
||||
docker start "$cid"
|
||||
docker cp ${{ github.workspace }}/tests/. "$cid":/tests
|
||||
docker exec "$cid" python3 /tests/base.py
|
||||
docker rm -f "$cid"
|
||||
|
||||
# --- 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: Tag Base image as latest
|
||||
run: |
|
||||
docker tag ${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}:${{ github.ref_name }} \
|
||||
${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}:latest
|
||||
|
||||
- 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 }}
|
||||
- name: Push Base image
|
||||
run: |
|
||||
docker push ${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}:${{ github.ref_name }}
|
||||
docker push ${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}:latest
|
||||
|
||||
# --- 2. BUILD & TEST JUPYTER IMAGE ---
|
||||
- name: Build Jupyter image
|
||||
run: |
|
||||
docker build \
|
||||
-f ./images/jupyter/dockerfile \
|
||||
--build-arg BASE_IMAGE=${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}:${{ github.ref_name }} \
|
||||
-t ${{ env.REGISTRY }}/${{ env.JUPYTER_IMAGE_NAME }}:${{ github.ref_name }} \
|
||||
./images/jupyter
|
||||
|
||||
- name: Test Jupyter dependencies
|
||||
run: |
|
||||
cid=$(docker create -w /tests ${{ env.REGISTRY }}/${{ env.JUPYTER_IMAGE_NAME }}:${{ github.ref_name }} sleep 60)
|
||||
docker start "$cid"
|
||||
docker cp ${{ github.workspace }}/tests/. "$cid":/tests
|
||||
docker exec "$cid" python3 /tests/dependencies.py
|
||||
docker rm -f "$cid"
|
||||
|
||||
- name: Tag Jupyter image as latest
|
||||
run: |
|
||||
docker tag ${{ env.REGISTRY }}/${{ env.JUPYTER_IMAGE_NAME }}:${{ github.ref_name }} \
|
||||
${{ env.REGISTRY }}/${{ env.JUPYTER_IMAGE_NAME }}:latest
|
||||
|
||||
- name: Push Jupyter image
|
||||
run: |
|
||||
docker push ${{ env.REGISTRY }}/${{ env.JUPYTER_IMAGE_NAME }}:${{ github.ref_name }}
|
||||
docker push ${{ env.REGISTRY }}/${{ env.JUPYTER_IMAGE_NAME }}:latest
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
FROM python:3.12-slim-bookworm AS base
|
||||
|
||||
LABEL org.opencontainers.image.title="tenant-base" \
|
||||
org.opencontainers.image.description="Hardened base image for tenant workspaces" \
|
||||
org.opencontainers.image.source="https://git.bouvais.lu/adrien/"
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
@@ -17,4 +13,3 @@ WORKDIR /home/appuser
|
||||
USER appuser
|
||||
|
||||
ENTRYPOINT ["tini", "--"]
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
ARG BASE_IMAGE=registry.bouvais.lu/tenant-base:1.0.0
|
||||
ARG BASE_IMAGE
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
LABEL org.opencontainers.image.title="tenant-jupyter" \
|
||||
org.opencontainers.image.description="JupyterLab image built on tenant-base" \
|
||||
org.opencontainers.image.base.name="${BASE_IMAGE}"
|
||||
|
||||
USER root
|
||||
COPY --chown=appuser:appuser test_buckets.py /home/appuser/work/test_buckets.py
|
||||
COPY --chown=appuser:appuser requirements.txt /tmp/requirements.txt
|
||||
RUN pip install --no-cache-dir -r /tmp/requirements.txt \
|
||||
&& rm /tmp/requirements.txt
|
||||
@@ -13,8 +10,6 @@ RUN pip install --no-cache-dir -r /tmp/requirements.txt \
|
||||
USER appuser
|
||||
WORKDIR /home/appuser/work
|
||||
|
||||
COPY --chown=appuser:appuser test_script.py /home/appuser/test_script.py
|
||||
|
||||
EXPOSE 8888
|
||||
|
||||
CMD ["jupyter", "lab", \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
image:
|
||||
repository: registry.bouvais.lu/tenant-jupyter
|
||||
tag: "1.0.0"
|
||||
repository: registry.bouvais.lu/tenant/jupyter
|
||||
tag: "1.0.1"
|
||||
|
||||
resources:
|
||||
requests:
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
name: "b"
|
||||
|
||||
image:
|
||||
repository: registry.bouvais.lu/tenant-jupyter
|
||||
tag: "latest"
|
||||
repository: registry.bouvais.lu/tenant/jupyter
|
||||
tag: "1.0.1"
|
||||
|
||||
resources:
|
||||
requests:
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
print("SUCCESS: Python works.")
|
||||
@@ -0,0 +1,3 @@
|
||||
import os
|
||||
import boto3
|
||||
print("SUCCESS: Import works.")
|
||||
Reference in New Issue
Block a user