From 24679b291b95343db978e596f6151a71605f21e6 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Wed, 26 Jun 2024 19:36:30 +0200 Subject: [PATCH] build slim image --- .github/workflows/docker-image.yml | 47 ++++++++++++++++++++++++++++++ docker/DockerfileNsjail | 2 +- docker/DockerfileSlim | 33 +++++++++++++++++++++ 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 docker/DockerfileSlim diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 0e73e0263a..1338a19ca9 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -618,3 +618,50 @@ jobs: labels: | ${{ steps.meta-ee-public.outputs.labels }} org.opencontainers.image.licenses=Windmill-Enterprise-License + + build_ee_slim: + if: ${{ startsWith(github.ref, 'refs/tags/') }} + needs: [build_ee] + runs-on: ubicloud + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v2 + + - uses: depot/setup-action@v1 + + - name: Docker meta + id: meta-ee-public + uses: docker/metadata-action@v4 + with: + images: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ee-slim + flavor: | + latest=false + tags: | + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + + - name: Login to registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push publicly ee + uses: depot/build-push-action@v1 + with: + context: . + platforms: linux/amd64 + push: true + file: "./docker/DockerfileSlim" + tags: | + ${{ steps.meta-ee-public.outputs.tags }} + labels: | + ${{ steps.meta-ee-public.outputs.labels }} + org.opencontainers.image.licenses=Windmill-Enterprise-License diff --git a/docker/DockerfileNsjail b/docker/DockerfileNsjail index 7189dd5d20..9aee2de39b 100644 --- a/docker/DockerfileNsjail +++ b/docker/DockerfileNsjail @@ -21,7 +21,7 @@ RUN apt-get -y update \ RUN git clone -b master --single-branch https://github.com/google/nsjail.git . && git checkout dccf911fd2659e7b08ce9507c25b2b38ec2c5800 RUN make -FROM ghcr.io/windmill-labs/windmill-ee:dev as downloader +FROM ghcr.io/windmill-labs/windmill-ee:dev RUN apt-get update && apt-get install -y libprotobuf-dev libnl-route-3-dev diff --git a/docker/DockerfileSlim b/docker/DockerfileSlim new file mode 100644 index 0000000000..7c65d8d36c --- /dev/null +++ b/docker/DockerfileSlim @@ -0,0 +1,33 @@ +ARG PYTHON_IMAGE=python:3.11.8-slim-bookworm + +FROM ${PYTHON_IMAGE} + +ARG APP=/usr/src/app + +RUN apt-get update \ + && apt-get install -y ca-certificates wget curl git jq unzip build-essential unixodbc xmlsec1 software-properties-common \ + && rm -rf /var/lib/apt/lists/* + +RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - +RUN apt-get -y update && apt-get install -y curl nodejs awscli + +ENV TZ=Etc/UTC + +RUN /usr/local/bin/python3 -m pip install pip-tools + +COPY --from=oven/bun:1.1.8 /usr/local/bin/bun /usr/bin/bun + +# add the docker client to call docker from a worker if enabled +COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/ + +WORKDIR ${APP} + +COPY --from=ghcr.io/windmill-labs/windmill-ee:dev --chmod=755 ${APP}/windmill ${APP}/windmill + +RUN ln -s ${APP}/windmill /usr/local/bin/windmill + +RUN windmill cache + +EXPOSE 8000 + +CMD ["windmill"]