Skip to content

Commit

Permalink
do not build slim image
Browse files Browse the repository at this point in the history
  • Loading branch information
aperrin66 committed Dec 6, 2023
1 parent 349f4e6 commit 6e85ae8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 51 deletions.
23 changes: 1 addition & 22 deletions .github/workflows/build_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@ jobs:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}

- name: Build standard docker image
- name: Build docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
target: 'standard'
build-args: 'PYTHON_VERSION=${{ matrix.version.python }}'
push: ${{ github.ref_type == 'tag' }}
tags: |
Expand All @@ -57,26 +56,6 @@ jobs:
${{ env.IMAGE_NAME }}:latest-python${{ matrix.version.python }}
cache-to: type=local,dest=/tmp/.buildx-cache-new

- name: Build slim docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
target: 'slim'
build-args: 'PYTHON_VERSION=${{ matrix.version.python }}'
push: ${{ github.ref_type == 'tag' }}
tags: |
${{ env.IMAGE_NAME }}:latest-slim-python${{ matrix.version.python }}
${{ matrix.version.latest && format('{0}:{1}{2}', env.IMAGE_NAME, github.ref_name, matrix.tag_suffix) || '' }}
${{ env.IMAGE_NAME }}:${{ github.ref_name }}-slim-python${{ matrix.version.python }}
${{ matrix.version.latest && format('{0}:latest-slim', env.IMAGE_NAME) || '' }}
cache-from: |
type=local,src=/tmp/.buildx-cache
type=local,src=/tmp/.buildx-cache-new
${{ env.IMAGE_NAME }}:latest-python${{ matrix.version.python }}
${{ env.IMAGE_NAME }}:${{ github.ref_name }}-slim-python${{ matrix.version.python }}
cache-to: type=local,dest=/tmp/.buildx-cache-new

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
Expand Down
30 changes: 1 addition & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM continuumio/miniconda3 as standard
FROM continuumio/miniconda3

LABEL maintainer="Anton Korosov <[email protected]>"
LABEL purpose="Python libs for developing and running Nansat"
Expand Down Expand Up @@ -35,31 +35,3 @@ ENV GDAL_DATA=/opt/conda/share/gdal
ENV PROJ_LIB=/opt/conda/share/proj

WORKDIR /src


FROM standard as slim_builder

RUN pip install conda-pack \
&& conda create --name to_pack --clone base \
&& conda-pack -n to_pack -o /tmp/env.tar \
&& mkdir /venv && tar -C /venv -xf /tmp/env.tar \
&& /venv/bin/conda-unpack

FROM debian:buster as slim

COPY --from=slim_builder /usr/share/MOD44W /usr/share/MOD44W
COPY --from=slim_builder /venv /venv
COPY --from=slim_builder /usr/lib/x86_64-linux-gnu/libXau.so.6* /usr/lib/x86_64-linux-gnu
RUN mkdir -p "/root/.local/share/pythesint"
COPY --from=slim_builder "/root/.local/share/pythesint" "/root/.local/share/pythesint"

ENV VIRTUAL_ENV='/venv'
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/src
ENV MOD44WPATH=/usr/share/MOD44W
ENV GDAL_DRIVER_PATH=/venv/lib/gdalplugins
ENV GDAL_DATA=/venv/share/gdal
ENV PROJ_LIB=/venv/share/proj

WORKDIR /src

0 comments on commit 6e85ae8

Please sign in to comment.