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:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- 'images/base/**'
|
|
||||||
- 'images/jupyter/**'
|
|
||||||
tags:
|
tags:
|
||||||
- 'v*.*.*'
|
- '*.*.*'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: registry.bouvais.lu
|
REGISTRY: registry.bouvais.lu
|
||||||
BASE_IMAGE_NAME: something/base
|
BASE_IMAGE_NAME: tenant/base
|
||||||
JUPYTER_IMAGE_NAME: something/jupyter
|
JUPYTER_IMAGE_NAME: tenant/jupyter
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@v3
|
run: |
|
||||||
with:
|
docker login ${{ env.REGISTRY }} \
|
||||||
registry: ${{ env.REGISTRY }}
|
--username adrien \
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
--password "${{ secrets.DOCKER_PASSWORD }}"
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
||||||
|
|
||||||
# --- 1. BUILD BASE IMAGE ---
|
# --- 1. BUILD & TEST BASE IMAGE ---
|
||||||
- name: Extract metadata for Base
|
- name: Build Base image
|
||||||
id: meta-base
|
run: |
|
||||||
uses: docker/metadata-action@v5
|
docker build \
|
||||||
with:
|
-f ./images/base/dockerfile \
|
||||||
images: ${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}
|
-t ${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}:${{ github.ref_name }} \
|
||||||
tags: |
|
./images/base
|
||||||
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
|
- name: Test Base image
|
||||||
uses: docker/build-push-action@v5
|
run: |
|
||||||
with:
|
cid=$(docker create -u root -w /tests ${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}:${{ github.ref_name }} sleep 60)
|
||||||
context: ./images/base
|
docker start "$cid"
|
||||||
# Note: Linux is case-sensitive. If your file is literally lowercase "dockerfile", change this to "dockerfile"
|
docker cp ${{ github.workspace }}/tests/. "$cid":/tests
|
||||||
file: ./images/base/Dockerfile
|
docker exec "$cid" python3 /tests/base.py
|
||||||
push: true
|
docker rm -f "$cid"
|
||||||
tags: ${{ steps.meta-base.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta-base.outputs.labels }}
|
|
||||||
|
|
||||||
# --- 2. BUILD JUPYTER IMAGE ---
|
- name: Tag Base image as latest
|
||||||
- name: Extract metadata for Jupyter
|
run: |
|
||||||
id: meta-jupyter
|
docker tag ${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}:${{ github.ref_name }} \
|
||||||
uses: docker/metadata-action@v5
|
${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}:latest
|
||||||
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
|
- name: Push Base image
|
||||||
uses: docker/build-push-action@v5
|
run: |
|
||||||
with:
|
docker push ${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}:${{ github.ref_name }}
|
||||||
context: ./images/jupyter
|
docker push ${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}:latest
|
||||||
file: ./images/jupyter/Dockerfile
|
|
||||||
push: true
|
# --- 2. BUILD & TEST JUPYTER IMAGE ---
|
||||||
tags: ${{ steps.meta-jupyter.outputs.tags }}
|
- name: Build Jupyter image
|
||||||
labels: ${{ steps.meta-jupyter.outputs.labels }}
|
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
|
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 \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
curl \
|
curl \
|
||||||
@@ -17,4 +13,3 @@ WORKDIR /home/appuser
|
|||||||
USER appuser
|
USER appuser
|
||||||
|
|
||||||
ENTRYPOINT ["tini", "--"]
|
ENTRYPOINT ["tini", "--"]
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
ARG BASE_IMAGE=registry.bouvais.lu/tenant-base:1.0.0
|
ARG BASE_IMAGE
|
||||||
FROM ${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
|
USER root
|
||||||
|
COPY --chown=appuser:appuser test_buckets.py /home/appuser/work/test_buckets.py
|
||||||
COPY --chown=appuser:appuser requirements.txt /tmp/requirements.txt
|
COPY --chown=appuser:appuser requirements.txt /tmp/requirements.txt
|
||||||
RUN pip install --no-cache-dir -r /tmp/requirements.txt \
|
RUN pip install --no-cache-dir -r /tmp/requirements.txt \
|
||||||
&& rm /tmp/requirements.txt
|
&& rm /tmp/requirements.txt
|
||||||
@@ -13,8 +10,6 @@ RUN pip install --no-cache-dir -r /tmp/requirements.txt \
|
|||||||
USER appuser
|
USER appuser
|
||||||
WORKDIR /home/appuser/work
|
WORKDIR /home/appuser/work
|
||||||
|
|
||||||
COPY --chown=appuser:appuser test_script.py /home/appuser/test_script.py
|
|
||||||
|
|
||||||
EXPOSE 8888
|
EXPOSE 8888
|
||||||
|
|
||||||
CMD ["jupyter", "lab", \
|
CMD ["jupyter", "lab", \
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
image:
|
image:
|
||||||
repository: registry.bouvais.lu/tenant-jupyter
|
repository: registry.bouvais.lu/tenant/jupyter
|
||||||
tag: "1.0.0"
|
tag: "1.0.1"
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
name: "b"
|
|
||||||
|
|
||||||
image:
|
image:
|
||||||
repository: registry.bouvais.lu/tenant-jupyter
|
repository: registry.bouvais.lu/tenant/jupyter
|
||||||
tag: "latest"
|
tag: "1.0.1"
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
requests:
|
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