Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dockerfile setup to use mamba #583

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
push:
branches:
- main
pull_request:
paths:
- "docker/**"

# When this workflow is queued, automatically cancel any previous running
# or pending jobs from the same branch
Expand All @@ -17,15 +20,20 @@ jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
if: github.repository == 'dask-contrib/dask-sql'
env:
DOCKER_PUSH: ${{ github.event_name == 'push' && github.repository == 'dask-contrib/dask-sql' }}
steps:
- name: Test env value
run: |
echo ${{ fromJSON(env.DOCKER_PUSH) }}
- name: Check out the repo
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: ${{ fromJSON(env.DOCKER_PUSH) }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
Expand All @@ -41,22 +49,34 @@ jobs:
context: .
file: ./docker/main.dockerfile
build-args: DOCKER_META_VERSION=${{ steps.docker_meta_main.outputs.version }}
platforms: linux/amd64,linux/arm64,linux/386
platforms: ${{ fromJSON(env.DOCKER_PUSH) && 'linux/amd64,linux/arm64,linux/386' || 'linux/amd64' }}
tags: ${{ steps.docker_meta_main.outputs.tags }}
labels: ${{ steps.docker_meta_main.outputs.labels }}
push: true
push: ${{ fromJSON(env.DOCKER_PUSH) }}
load: ${{ !fromJSON(env.DOCKER_PUSH) }}
- name: Check images
run: |
df -h
docker image ls
docker image inspect ${{ steps.docker_meta_main.outputs.tags }}

- name: Docker meta for cloud image
id: docker_meta_cloud
uses: crazy-max/ghaction-docker-meta@v1
with:
images: nbraun/dask-sql-cloud
- name: Check images_2
run: |
df -h
docker image ls
docker image inspect ${{ steps.docker_meta_main.outputs.tags }}
- name: Build and push cloud image
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/cloud.dockerfile
build-args: DOCKER_META_VERSION=${{ steps.docker_meta_main.outputs.version }}
platforms: linux/amd64,linux/arm64,linux/386
platforms: ${{ fromJSON(env.DOCKER_PUSH) && 'linux/amd64,linux/arm64,linux/386' || 'linux/amd64' }}
tags: ${{ steps.docker_meta_cloud.outputs.tags }}
labels: ${{ steps.docker_meta_cloud.outputs.labels }}
push: true
push: ${{ fromJSON(env.DOCKER_PUSH) }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure but I think you might need to change this to be load: true in order for it to pick up the local base image. Then add an additional push step. Setting load: true changes the behaviour of the builder.

See https://stackoverflow.com/a/63927832/1003288

4 changes: 2 additions & 2 deletions docker/cloud.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ ARG DOCKER_META_VERSION
FROM nbraun/dask-sql:${DOCKER_META_VERSION}

RUN conda config --add channels conda-forge \
&& /opt/conda/bin/conda install --freeze-installed \
&& /opt/conda/bin/mamba install --freeze-installed \
"s3fs" \
"dask-cloudprovider" \
"dask-cloudprovider" -y \
&& pip install awscli \
&& conda clean -ay

Expand Down
4 changes: 2 additions & 2 deletions docker/main.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LABEL author "Nils Braun <[email protected]>"
# Install dependencies for dask-sql
COPY docker/conda.txt /opt/dask_sql/
RUN conda config --add channels conda-forge \
&& /opt/conda/bin/conda install --freeze-installed \
&& /opt/conda/bin/mamba install --freeze-installed \
"jpype1>=1.0.2" \
"openjdk>=11" \
"maven>=3.6.0" \
Expand All @@ -18,7 +18,7 @@ RUN conda config --add channels conda-forge \
"pygments>=2.7.1" \
"dask-ml>=2022.1.22" \
"scikit-learn>=1.0.0" \
"intake>=0.6.0" \
"intake>=0.6.0" -y \
&& conda clean -ay

# install dask-sql
Expand Down