-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from childmindresearch/dockerfile
Add dockerfile
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
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,40 @@ | ||
name: Deploy Docker image | ||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMG_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
docker_build_and_push: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Login to GHCR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract tags, labels for image | ||
id: metadata | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ env.REGISTRY }}/${{ env.IMG_NAME }} | ||
- name: Build and push image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.metadata.outputs.tags }} | ||
labels: ${{ steps.metadata.outputs.labels }} |
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,30 @@ | ||
ARG PY_VERSION=3.11 | ||
FROM python:${PY_VERSION}-slim-bookworm as python | ||
RUN apt-get update -qq \ | ||
&& apt-get install -y -q --no-install-recommends \ | ||
build-essential \ | ||
ffmpeg \ | ||
libcurl4 \ | ||
git \ | ||
openssl \ | ||
&& python -m pip install --upgrade pip \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
|
||
# NOTE: Set version to be able to checkout tag in future | ||
# (for now, installing latest from `main`) | ||
FROM python as builder | ||
ARG NIFTYONE_VER=0.0.0 | ||
COPY . /opt/niftyone/ | ||
RUN cd /opt/niftyone \ | ||
&& pip wheel --no-deps --prefer-binary . | ||
|
||
FROM builder as runtime | ||
WORKDIR /home | ||
ENV OS=LINUX | ||
RUN WHEEL=`ls /opt/niftyone | grep whl` \ | ||
&& pip install /opt/niftyone/${WHEEL} \ | ||
&& rm -r /opt/niftyone \ | ||
&& apt-get --purge -y -qq autoremove | ||
EXPOSE 5151 | ||
ENTRYPOINT ["niftyone"] |