Skip to content

Commit

Permalink
Add Python-slim Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
banesullivan committed Apr 26, 2022
1 parent fc23836 commit 725da58
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 7 deletions.
7 changes: 0 additions & 7 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
build
test
.git
girder
girder_annotation
large_image
sources
utilities
examples
37 changes: 37 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Docker Package
on:
push:
tags: "*"
branches:
- master
pull_request:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-publish:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || ( github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository )
steps:
- uses: actions/checkout@v2
- name: Log into the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: token
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for the Docker image
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push the Docker image
uses: docker/build-push-action@v2
with:
context: .
file: slim.Dockerfile
push: ${{ github.actor != 'dependabot[bot]' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
31 changes: 31 additions & 0 deletions slim.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Build wheels
FROM python:3.9-slim as build

# Need git for setuptools_scm
RUN apt-get update \
&& apt-get install -y --no-install-recommends git \
&& apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/*

COPY . /opt/build-context/
WORKDIR /opt/build-context

RUN python -m pip install --upgrade pip wheel setuptools
RUN sh .circleci/make_wheels.sh
RUN mv ~/wheels /opt/build-context/

# Production
FROM python:3.9-slim

COPY --from=build /opt/build-context/wheels /opt/wheels
LABEL maintainer="Kitware, Inc. <[email protected]>"
LABEL repo="https://github.com/girder/large_image"
# NOTE: this does not install any girder3 packages
RUN pip install \
--find-links https://girder.github.io/large_image_wheels \
--find-links=/opt/wheels \
'pylibmc>=1.5.1' \
matplotlib \
pyvips \
simplejpeg \
$(ls -1 /opt/wheels/large_image*.whl)

0 comments on commit 725da58

Please sign in to comment.