-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
name: Create and publish a Docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- "!*" | ||
tags: | ||
- "v*" | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
LAB_NAME: lab | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- 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 base-image | ||
id: meta-base | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: ${{ github.event_name == 'push' }} | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.meta-base.outputs.tags }} | ||
labels: ${{ steps.meta-base.outputs.labels }} | ||
target: base | ||
|
||
- name: Extract metadata (tags, labels) for lab images | ||
id: meta-lab | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ env.LAB_NAME }} | ||
|
||
- name: Build and push Docker lab image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: ${{ github.event_name == 'push' }} | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.meta-lab.outputs.tags }} | ||
labels: ${{ steps.meta-lab.outputs.labels }} | ||
target: lab |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from ubuntu:22.04 as base | ||
|
||
RUN apt-get update && apt-get install -y python3-pip gcc python3-dev && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /repo | ||
|
||
COPY requirements.txt /repo | ||
|
||
RUN python3 -m pip install --upgrade pip | ||
RUN python3 -m pip install --no-cache-dir -r requirements.txt | ||
# Install the headless version of opencv in docker | ||
RUN python3 -m pip uninstall -y opencv-python opencv-contrib-python | ||
RUN python3 -m pip install --no-cache-dir opencv-python-headless opencv-contrib-python-headless | ||
|
||
|
||
COPY . /repo | ||
|
||
FROM base as lab | ||
|
||
# Had some issues with psutil (needed by jupyter) on aarch64, so need to install it from source | ||
RUN python3 -m pip install --no-cache-dir psutil --no-binary=psutil | ||
RUN python3 -m pip install --no-cache-dir jupyter | ||
|
||
EXPOSE 8888/tcp | ||
ENTRYPOINT [ "jupyter", "lab", "--ip", "0.0.0.0", "--port", "8888", "--no-browser", "--allow-root"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
python-3.10 |