diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..9965837ea --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +* +!target/debug/nu* +!target/release/nu* +!dist/* +!LICENSE +!*.md \ No newline at end of file diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index f8bb3474a..1e6f1881d 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -47,10 +47,10 @@ jobs: - { tag: alpine, base-image: alpine, arch: x86_64-unknown-linux-musl, plugin: true } - { tag: slim, base-image: 'debian:stable-slim', arch: x86_64-unknown-linux-gnu, plugin: true } - { tag: debian, base-image: debian, arch: x86_64-unknown-linux-gnu, plugin: true } - - { tag: glibc-busybox, base-image: 'busybox:glibc', arch: x86_64-unknown-linux-gnu, plugin: false } + - { tag: glibc-busybox, base-image: 'busybox:glibc', arch: x86_64-unknown-linux-gnu, plugin: false, use-patch: true } - { tag: musl-busybox, base-image: 'busybox:musl', arch: x86_64-unknown-linux-musl, plugin: false } - { tag: musl-distroless, base-image: 'gcr.io/distroless/static', arch: x86_64-unknown-linux-musl, plugin: false } - - { tag: glibc-distroless, base-image: 'gcr.io/distroless/base', arch: x86_64-unknown-linux-gnu, plugin: false } + - { tag: glibc-distroless, base-image: 'gcr.io/distroless/base', arch: x86_64-unknown-linux-gnu, plugin: false, use-patch: true } - { tag: glibc, base-image: scratch, arch: x86_64-unknown-linux-gnu, plugin: false } - { tag: musl, base-image: scratch, arch: x86_64-unknown-linux-musl, plugin: false } steps: @@ -61,6 +61,7 @@ jobs: run: | REGISTRY=${REGISTRY,,}; export TAG=${GITHUB_REF##*/}-${{ matrix.tag }}; export NU_BINS=target/release/$( [ ${{ matrix.plugin }} = true ] && echo nu* || echo nu ) + export PATCH=$([ ${{ matrix.use-patch }} = true ] && echo .patch || echo '') chmod +x $NU_BINS echo ${{ secrets.DOCKER_REGISTRY }} | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin diff --git a/docker/Package.Dockerfile b/docker/Package.Dockerfile index fd3015c28..a9040d290 100644 --- a/docker/Package.Dockerfile +++ b/docker/Package.Dockerfile @@ -3,4 +3,5 @@ FROM ${base} ARG artifact COPY ${artifact} /bin/ + ENTRYPOINT ["/bin/nu"] \ No newline at end of file diff --git a/docker/Package.patch.Dockerfile b/docker/Package.patch.Dockerfile new file mode 100644 index 000000000..250146f88 --- /dev/null +++ b/docker/Package.patch.Dockerfile @@ -0,0 +1,9 @@ +ARG base +FROM debian:stable-slim AS patch +FROM ${base} + +ARG artifact +COPY ${artifact} /bin/ + +COPY --from=patch /lib/x86_64-linux-gnu/libz.so.1 /lib/x86_64-linux-gnu/libz.so.1 +ENTRYPOINT ["/bin/nu"] \ No newline at end of file diff --git a/docker/docker-compose.package.yml b/docker/docker-compose.package.yml index 3622fa0cf..9be36544e 100644 --- a/docker/docker-compose.package.yml +++ b/docker/docker-compose.package.yml @@ -5,7 +5,7 @@ services: image: ${REGISTRY}/nu:${TAG} build: context: .. - dockerfile: docker/Package.Dockerfile + dockerfile: docker/Package${PATCH}.Dockerfile args: base: ${BASE_IMAGE} artifact: ${NU_BINS}