From 4c2677774691b51bf7fc9d59e9218eb42f27ad58 Mon Sep 17 00:00:00 2001 From: edoardob90 Date: Wed, 20 Nov 2024 10:01:59 +0100 Subject: [PATCH 01/11] Add a starting Dockerfile --- Dockerfile | 60 +++++++++++++++++++++++++++++++++++ docker/activate-custom-env.sh | 2 ++ docker/post-build.sh | 5 +++ docker/setup_custom_env.py | 52 ++++++++++++++++++++++++++++++ 4 files changed, 119 insertions(+) create mode 100644 Dockerfile create mode 100644 docker/activate-custom-env.sh create mode 100755 docker/post-build.sh create mode 100644 docker/setup_custom_env.py diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..ed71d5e5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,60 @@ +# Use the jupyter/minimal-notebook as the base image +FROM quay.io/jupyter/minimal-notebook:latest + +# Switch to root user to install additional dependencies (if needed) +USER root + +# Install additional dependencies +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + build-essential \ + gcc \ + g++ \ + libffi-dev \ + && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Copy the script to setup the environment +COPY docker/setup_custom_env.py /opt/setup-scripts/ +# Make the script executable +RUN chmod +x /opt/setup-scripts/setup_custom_env.py + +# Copy the script to activate the Conda environment +COPY docker/activate-custom-env.sh /usr/local/bin/before-notebook.d/ + +# Switch back to the default notebook user +USER ${NB_UID} + +# Set a shortcut to the tutorial name +ENV BASENAME="python-tutorial" + +# Set the working directory to the home directory of the notebook user +WORKDIR ${HOME} + +# Clone the tutorial repository +RUN git clone \ + --branch main \ + --depth 1 \ + https://github.com/empa-scientific-it/${BASENAME} + +WORKDIR ${HOME}/${BASENAME} + +# Create the Conda environment defined in environment.yml +RUN mamba env create -f binder/environment.yml && \ + mamba clean --all -f -y && \ + fix-permissions "${CONDA_DIR}" && \ + fix-permissions "/home/${NB_USER}" + +# Register the Jupyter kernel from the custom environment +RUN /opt/setup-scripts/setup_custom_env.py ${BASENAME} + +# Copy the IPython configuration file +RUN mkdir -p ${HOME}/.ipython/profile_default +COPY binder/ipython_config.py ${HOME}/.ipython/profile_default/ + +# Set the environment variable IPYTHONDIR +ENV IPYTHONDIR="${HOME}/.ipython" + +# Use the default ENTRYPOINT from the base image to start Jupyter Lab +ENTRYPOINT ["tini", "-g", "--", "start.sh"] diff --git a/docker/activate-custom-env.sh b/docker/activate-custom-env.sh new file mode 100644 index 00000000..deb43178 --- /dev/null +++ b/docker/activate-custom-env.sh @@ -0,0 +1,2 @@ +#!/bin/bash +conda activate python-tutorial diff --git a/docker/post-build.sh b/docker/post-build.sh new file mode 100755 index 00000000..90c25f1c --- /dev/null +++ b/docker/post-build.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e + +mkdir -p ${HOME}/.ipython/profile_default +cp binder/ipython_config.py ${HOME}/.ipython/profile_default/ diff --git a/docker/setup_custom_env.py b/docker/setup_custom_env.py new file mode 100644 index 00000000..afcd8e94 --- /dev/null +++ b/docker/setup_custom_env.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +import json +import os +import sys +from pathlib import Path + +# Retrieve the environment name from the command-line arguments +env_name = sys.argv[1] + +# Get the Conda directory from the environment variables +CONDA_DIR = os.environ["CONDA_DIR"] + +# Define the path to the kernel.json file +kernel_dir = Path.home() / f".local/share/jupyter/kernels/{env_name}" +kernel_file = kernel_dir / "kernel.json" + +# Ensure the kernel directory exists +kernel_dir.mkdir(parents=True, exist_ok=True) + +# Define default kernel.json content +default_content = { + "argv": [ + f"{CONDA_DIR}/envs/{env_name}/bin/python", + "-m", + "ipykernel_launcher", + "-f", + "{connection_file}", + ], + "display_name": f"Python ({env_name})", + "language": "python", +} + +# If the kernel.json file doesn't exist, create it with default content +if not kernel_file.exists(): + kernel_file.write_text(json.dumps(default_content, indent=1)) + +# Read the existing kernel.json content +content = json.loads(kernel_file.read_text()) + +# Add the environment variables to the kernel configuration +content["env"] = { + "XML_CATALOG_FILES": "", + "PATH": f"{CONDA_DIR}/envs/{env_name}/bin:$PATH", + "CONDA_PREFIX": f"{CONDA_DIR}/envs/{env_name}", + "CONDA_PROMPT_MODIFIER": f"({env_name}) ", + "CONDA_SHLVL": "2", + "CONDA_DEFAULT_ENV": env_name, + "CONDA_PREFIX_1": CONDA_DIR, +} + +# Write the updated content back to the kernel.json file +kernel_file.write_text(json.dumps(content, indent=1)) From 3ac0f441c9d8ac355b3aba2ffae5527bca87c586 Mon Sep 17 00:00:00 2001 From: Edoardo Baldi Date: Wed, 20 Nov 2024 13:20:49 +0100 Subject: [PATCH 02/11] Paths fixed --- Dockerfile | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index ed71d5e5..70984b9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,22 @@ # Use the jupyter/minimal-notebook as the base image FROM quay.io/jupyter/minimal-notebook:latest +# Set a shortcut to the tutorial name +ENV BASENAME="python-tutorial" +ENV REPO="https://github.com/edoardob90/${BASENAME}" + +# Set the working directory to the home directory of the notebook user +WORKDIR ${HOME} + +# Clone the tutorial repository +RUN git clone \ + --branch add-dockerfile \ + --depth 1 \ + ${REPO} + +# Set the working directory to the repository directory +WORKDIR ${BASENAME} + # Switch to root user to install additional dependencies (if needed) USER root @@ -16,29 +32,17 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* # Copy the script to setup the environment -COPY docker/setup_custom_env.py /opt/setup-scripts/ -# Make the script executable -RUN chmod +x /opt/setup-scripts/setup_custom_env.py +RUN cp -a docker/setup_custom_env.py /opt/setup-scripts/ && \ + chmod +x /opt/setup-scripts/setup_custom_env.py # Copy the script to activate the Conda environment -COPY docker/activate-custom-env.sh /usr/local/bin/before-notebook.d/ +RUN cp -a docker/activate-custom-env.sh /usr/local/bin/before-notebook.d/ # Switch back to the default notebook user USER ${NB_UID} -# Set a shortcut to the tutorial name -ENV BASENAME="python-tutorial" - -# Set the working directory to the home directory of the notebook user -WORKDIR ${HOME} - -# Clone the tutorial repository -RUN git clone \ - --branch main \ - --depth 1 \ - https://github.com/empa-scientific-it/${BASENAME} - -WORKDIR ${HOME}/${BASENAME} +# Set the working directory to the repository directory +# WORKDIR ${HOME}/${BASENAME} # Create the Conda environment defined in environment.yml RUN mamba env create -f binder/environment.yml && \ @@ -49,7 +53,7 @@ RUN mamba env create -f binder/environment.yml && \ # Register the Jupyter kernel from the custom environment RUN /opt/setup-scripts/setup_custom_env.py ${BASENAME} -# Copy the IPython configuration file +# Copy the IPython configuration file (binder/postBuild script) RUN mkdir -p ${HOME}/.ipython/profile_default COPY binder/ipython_config.py ${HOME}/.ipython/profile_default/ From dd70a0e41a1c683a387b487093d05b5844f55fe6 Mon Sep 17 00:00:00 2001 From: edoardob90 Date: Wed, 20 Nov 2024 14:05:51 +0100 Subject: [PATCH 03/11] Use base environment --- Dockerfile | 17 +++++++---------- docker/environment.yml | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 docker/environment.yml diff --git a/Dockerfile b/Dockerfile index 70984b9a..76bf767f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,30 +32,27 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* # Copy the script to setup the environment -RUN cp -a docker/setup_custom_env.py /opt/setup-scripts/ && \ - chmod +x /opt/setup-scripts/setup_custom_env.py +# RUN cp -a docker/setup_custom_env.py /opt/setup-scripts/ && \ +# chmod +x /opt/setup-scripts/setup_custom_env.py # Copy the script to activate the Conda environment -RUN cp -a docker/activate-custom-env.sh /usr/local/bin/before-notebook.d/ +# RUN cp -a docker/activate-custom-env.sh /usr/local/bin/before-notebook.d/ # Switch back to the default notebook user USER ${NB_UID} -# Set the working directory to the repository directory -# WORKDIR ${HOME}/${BASENAME} - # Create the Conda environment defined in environment.yml -RUN mamba env create -f binder/environment.yml && \ +RUN mamba env update -f docker/environment.yml && \ mamba clean --all -f -y && \ fix-permissions "${CONDA_DIR}" && \ fix-permissions "/home/${NB_USER}" # Register the Jupyter kernel from the custom environment -RUN /opt/setup-scripts/setup_custom_env.py ${BASENAME} +# RUN /opt/setup-scripts/setup_custom_env.py ${BASENAME} # Copy the IPython configuration file (binder/postBuild script) -RUN mkdir -p ${HOME}/.ipython/profile_default -COPY binder/ipython_config.py ${HOME}/.ipython/profile_default/ +RUN mkdir -p ${HOME}/.ipython/profile_default && \ + cp -a binder/ipython_config.py ${HOME}/.ipython/profile_default/ # Set the environment variable IPYTHONDIR ENV IPYTHONDIR="${HOME}/.ipython" diff --git a/docker/environment.yml b/docker/environment.yml new file mode 100644 index 00000000..ade81543 --- /dev/null +++ b/docker/environment.yml @@ -0,0 +1,23 @@ +--- +name: base +channels: + - conda-forge +dependencies: + - python=3.10 + - pip + - pip: + - numpy + - matplotlib + - pandas + - ipywidgets + - ipynbname + - jupyterlab + - pytest + - pytest-timeout + - markdown + - pre-commit + - geostatspy + - gstools + - scikit-learn + - attrs + - multiprocess From a1ef367c337a58cbb0eb7b2857c480677fdd4f61 Mon Sep 17 00:00:00 2001 From: edoardob90 Date: Wed, 20 Nov 2024 14:37:48 +0100 Subject: [PATCH 04/11] Remove pinned python version --- Dockerfile | 15 +++------------ docker/environment.yml | 1 - 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 76bf767f..6b1903e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ WORKDIR ${HOME} # Clone the tutorial repository RUN git clone \ - --branch add-dockerfile \ + --branch main \ --depth 1 \ ${REPO} @@ -31,25 +31,16 @@ RUN apt-get update && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* -# Copy the script to setup the environment -# RUN cp -a docker/setup_custom_env.py /opt/setup-scripts/ && \ -# chmod +x /opt/setup-scripts/setup_custom_env.py - -# Copy the script to activate the Conda environment -# RUN cp -a docker/activate-custom-env.sh /usr/local/bin/before-notebook.d/ - # Switch back to the default notebook user USER ${NB_UID} # Create the Conda environment defined in environment.yml -RUN mamba env update -f docker/environment.yml && \ +# COPY --chown=${NB_USER}:${NB_GID} docker/environment.yml docker/environment.yml +RUN mamba env update -n base -f docker/environment.yml && \ mamba clean --all -f -y && \ fix-permissions "${CONDA_DIR}" && \ fix-permissions "/home/${NB_USER}" -# Register the Jupyter kernel from the custom environment -# RUN /opt/setup-scripts/setup_custom_env.py ${BASENAME} - # Copy the IPython configuration file (binder/postBuild script) RUN mkdir -p ${HOME}/.ipython/profile_default && \ cp -a binder/ipython_config.py ${HOME}/.ipython/profile_default/ diff --git a/docker/environment.yml b/docker/environment.yml index ade81543..5e4420c7 100644 --- a/docker/environment.yml +++ b/docker/environment.yml @@ -3,7 +3,6 @@ name: base channels: - conda-forge dependencies: - - python=3.10 - pip - pip: - numpy From 46fd36f324302a88f565ed7266c9b953e04d6567 Mon Sep 17 00:00:00 2001 From: edoardob90 Date: Wed, 20 Nov 2024 15:16:15 +0100 Subject: [PATCH 05/11] Optimize Docker image build --- .dockerignore | 4 ++++ Dockerfile | 44 +++++++++++++++++--------------------------- 2 files changed, 21 insertions(+), 27 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..8513c1d3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.git +slides/ +.DS_Store +__pycache__/ diff --git a/Dockerfile b/Dockerfile index 6b1903e6..2d980eb4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,52 +1,42 @@ # Use the jupyter/minimal-notebook as the base image FROM quay.io/jupyter/minimal-notebook:latest -# Set a shortcut to the tutorial name +# Set environment variables for the tutorial and repository ENV BASENAME="python-tutorial" -ENV REPO="https://github.com/edoardob90/${BASENAME}" - -# Set the working directory to the home directory of the notebook user -WORKDIR ${HOME} - -# Clone the tutorial repository -RUN git clone \ - --branch main \ - --depth 1 \ - ${REPO} - -# Set the working directory to the repository directory -WORKDIR ${BASENAME} +ENV REPO=${HOME}/${BASENAME} +ENV IPYTHONDIR="${HOME}/.ipython" -# Switch to root user to install additional dependencies (if needed) +# Switch to root user to install additional dependencies USER root - -# Install additional dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ gcc \ g++ \ - libffi-dev \ - && \ + libffi-dev && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # Switch back to the default notebook user USER ${NB_UID} -# Create the Conda environment defined in environment.yml -# COPY --chown=${NB_USER}:${NB_GID} docker/environment.yml docker/environment.yml -RUN mamba env update -n base -f docker/environment.yml && \ +# Set up the Conda environment +COPY docker/environment.yml /tmp/environment.yml +RUN mamba env update -n base -f /tmp/environment.yml && \ mamba clean --all -f -y && \ fix-permissions "${CONDA_DIR}" && \ fix-permissions "/home/${NB_USER}" -# Copy the IPython configuration file (binder/postBuild script) -RUN mkdir -p ${HOME}/.ipython/profile_default && \ - cp -a binder/ipython_config.py ${HOME}/.ipython/profile_default/ +# Prepare IPython configuration (move earlier in the build) +RUN mkdir -p ${HOME}/.ipython/profile_default +COPY --chown=${NB_UID}:${NB_GID} binder/ipython_config.py ${HOME}/.ipython/profile_default/ -# Set the environment variable IPYTHONDIR -ENV IPYTHONDIR="${HOME}/.ipython" +# Copy the repository late in the build process +RUN mkdir -p ${REPO} +COPY --chown=${NB_UID}:${NB_GID} . ${REPO}/ + +# Set the working directory to the repository +WORKDIR ${REPO} # Use the default ENTRYPOINT from the base image to start Jupyter Lab ENTRYPOINT ["tini", "-g", "--", "start.sh"] From ebab11842bf35f011e0be3ec07699bb01ac6e394 Mon Sep 17 00:00:00 2001 From: edoardob90 Date: Wed, 20 Nov 2024 15:29:51 +0100 Subject: [PATCH 06/11] Add metadata labels --- Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Dockerfile b/Dockerfile index 2d980eb4..7fdae0f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,15 @@ # Use the jupyter/minimal-notebook as the base image FROM quay.io/jupyter/minimal-notebook:latest +# Metadata labels +LABEL org.opencontainers.image.title="Python Tutorial" +LABEL org.opencontainers.image.description="A containerized Python tutorial environment with Jupyter Lab." +LABEL org.opencontainers.image.authors="Empa Scientific IT " +LABEL org.opencontainers.image.url="https://github.com/empa-scientific-it/python-tutorial" +LABEL org.opencontainers.image.source="https://github.com/empa-scientific-it/python-tutorial" +LABEL org.opencontainers.image.version="1.0.0" +LABEL org.opencontainers.image.licenses="MIT" + # Set environment variables for the tutorial and repository ENV BASENAME="python-tutorial" ENV REPO=${HOME}/${BASENAME} From 7a939de1284f49fc1706c128addab31f1dc245b8 Mon Sep 17 00:00:00 2001 From: edoardob90 Date: Wed, 20 Nov 2024 15:30:44 +0100 Subject: [PATCH 07/11] Add GitHub workflow --- .github/workflows/docker-build.yml | 36 +++++++++++++++++++ ...build-docker-image.yml => repo2docker.yml} | 0 2 files changed, 36 insertions(+) create mode 100644 .github/workflows/docker-build.yml rename .github/workflows/{build-docker-image.yml => repo2docker.yml} (100%) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 00000000..3191db75 --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,36 @@ +name: Build Tutorial Container + +on: + push: + branches: + - main + paths-ignore: + - "*.md" + - slides/** + - images/** + - .gitignore + workflow_dispatch: + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build the Docker image + run: | + docker build -t ghcr.io/${{ github.repository }}:latest . + + - name: Push the Docker image + run: | + docker push ghcr.io/${{ github.repository }}:latest diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/repo2docker.yml similarity index 100% rename from .github/workflows/build-docker-image.yml rename to .github/workflows/repo2docker.yml From fe3520f23d5fc539bba775cedf3229295f25f3c3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 14:38:40 +0000 Subject: [PATCH 08/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/docker-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 3191db75..d986d7d4 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -1,3 +1,4 @@ +--- name: Build Tutorial Container on: From 521ae7b4f5bbb841593d6844a1c62b9de29b4cdc Mon Sep 17 00:00:00 2001 From: edoardob90 Date: Fri, 22 Nov 2024 11:21:13 +0100 Subject: [PATCH 09/11] Add AI dependencies --- binder/environment.yml | 4 ++++ docker/environment.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/binder/environment.yml b/binder/environment.yml index 7d382e1d..60d0322a 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -21,3 +21,7 @@ dependencies: - scikit-learn - attrs - multiprocess + - openai + - tenacity + - markdown2 + - python-dotenv diff --git a/docker/environment.yml b/docker/environment.yml index 5e4420c7..b9a588de 100644 --- a/docker/environment.yml +++ b/docker/environment.yml @@ -20,3 +20,7 @@ dependencies: - scikit-learn - attrs - multiprocess + - openai + - tenacity + - markdown2 + - python-dotenv From 6d1f3811d967981f34a929af3e78c29a24540cc7 Mon Sep 17 00:00:00 2001 From: Edoardo Baldi Date: Mon, 25 Nov 2024 21:33:37 +0100 Subject: [PATCH 10/11] Remove unused files --- docker/activate-custom-env.sh | 2 -- docker/post-build.sh | 5 ---- docker/setup_custom_env.py | 52 ----------------------------------- 3 files changed, 59 deletions(-) delete mode 100644 docker/activate-custom-env.sh delete mode 100755 docker/post-build.sh delete mode 100644 docker/setup_custom_env.py diff --git a/docker/activate-custom-env.sh b/docker/activate-custom-env.sh deleted file mode 100644 index deb43178..00000000 --- a/docker/activate-custom-env.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -conda activate python-tutorial diff --git a/docker/post-build.sh b/docker/post-build.sh deleted file mode 100755 index 90c25f1c..00000000 --- a/docker/post-build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -set -e - -mkdir -p ${HOME}/.ipython/profile_default -cp binder/ipython_config.py ${HOME}/.ipython/profile_default/ diff --git a/docker/setup_custom_env.py b/docker/setup_custom_env.py deleted file mode 100644 index afcd8e94..00000000 --- a/docker/setup_custom_env.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python3 -import json -import os -import sys -from pathlib import Path - -# Retrieve the environment name from the command-line arguments -env_name = sys.argv[1] - -# Get the Conda directory from the environment variables -CONDA_DIR = os.environ["CONDA_DIR"] - -# Define the path to the kernel.json file -kernel_dir = Path.home() / f".local/share/jupyter/kernels/{env_name}" -kernel_file = kernel_dir / "kernel.json" - -# Ensure the kernel directory exists -kernel_dir.mkdir(parents=True, exist_ok=True) - -# Define default kernel.json content -default_content = { - "argv": [ - f"{CONDA_DIR}/envs/{env_name}/bin/python", - "-m", - "ipykernel_launcher", - "-f", - "{connection_file}", - ], - "display_name": f"Python ({env_name})", - "language": "python", -} - -# If the kernel.json file doesn't exist, create it with default content -if not kernel_file.exists(): - kernel_file.write_text(json.dumps(default_content, indent=1)) - -# Read the existing kernel.json content -content = json.loads(kernel_file.read_text()) - -# Add the environment variables to the kernel configuration -content["env"] = { - "XML_CATALOG_FILES": "", - "PATH": f"{CONDA_DIR}/envs/{env_name}/bin:$PATH", - "CONDA_PREFIX": f"{CONDA_DIR}/envs/{env_name}", - "CONDA_PROMPT_MODIFIER": f"({env_name}) ", - "CONDA_SHLVL": "2", - "CONDA_DEFAULT_ENV": env_name, - "CONDA_PREFIX_1": CONDA_DIR, -} - -# Write the updated content back to the kernel.json file -kernel_file.write_text(json.dumps(content, indent=1)) From 3786be671ca9de635d799102d3055f7417dac19a Mon Sep 17 00:00:00 2001 From: Edoardo Baldi Date: Mon, 25 Nov 2024 21:45:18 +0100 Subject: [PATCH 11/11] Use official actions --- .github/workflows/docker-build.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index d986d7d4..ef1de6d2 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -18,8 +18,8 @@ jobs: permissions: packages: write steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Log in to GHCR uses: docker/login-action@v3 @@ -28,10 +28,9 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build the Docker image - run: | - docker build -t ghcr.io/${{ github.repository }}:latest . - - - name: Push the Docker image - run: | - docker push ghcr.io/${{ github.repository }}:latest + - name: Build and push + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/${{ github.repository }}:latest