|
| 1 | +# syntax=docker/dockerfile:latest |
| 2 | + |
| 3 | +# Git: git version 2.30.2 |
| 4 | +# /etc/os-release: Alpine Linux v3.20 |
| 5 | +# Kernel: Linux ca3abedc4fb1 5.17.15-76051715-generic #202206141358~1655919116~22.04~1db9e34 SMP PREEMPT Wed Jun 22 19 x86_64 Linux |
| 6 | +# Build cmd: docker build --no-cache . -t nushell:latest |
| 7 | +# Other tags: nushell:latest-alpine, nushell |
| 8 | +FROM alpine |
| 9 | + |
| 10 | +ARG TARGETARCH |
| 11 | +ARG ARCH=${TARGETARCH/arm64/aarch64} |
| 12 | +ARG ARCH=${ARCH/arm/armv7} |
| 13 | +ARG ARCH=${ARCH/amd64/x86_64} |
| 14 | + |
| 15 | +ARG BUILD_REF |
| 16 | +ARG BUILD_DATE |
| 17 | +ARG RELEASE_QUERY_API="https://api.github.com/repos/nushell/nushell/releases/latest" |
| 18 | + |
| 19 | +LABEL maintainer="The Nushell Project Developers" \ |
| 20 | + org.opencontainers.image.licenses="MIT" \ |
| 21 | + org.opencontainers.image.title="Nushell" \ |
| 22 | + org.opencontainers.image.created=$BUILD_DATE \ |
| 23 | + org.opencontainers.image.revision=$BUILD_REF \ |
| 24 | + org.opencontainers.image.authors="The Nushell Project Developers" \ |
| 25 | + org.opencontainers.image.vendor="Nushell Project" \ |
| 26 | + org.opencontainers.image.description="A new type of shell" \ |
| 27 | + org.opencontainers.image.source="https://github.com/nushell/nushell" \ |
| 28 | + org.opencontainers.image.documentation="https://www.nushell.sh/book/" |
| 29 | + |
| 30 | +RUN echo '/usr/bin/nu' >> /etc/shells \ |
| 31 | + && adduser -D -s /usr/bin/nu nushell \ |
| 32 | + && mkdir -p /home/nushell/.config/nushell/ \ |
| 33 | + && cd /tmp \ |
| 34 | + && wget -qO - ${RELEASE_QUERY_API} \ |
| 35 | + | grep browser_download_url \ |
| 36 | + | cut -d '"' -f 4 \ |
| 37 | + | grep ${ARCH}-unknown-linux-musl \ |
| 38 | + | xargs -I{} wget {} \ |
| 39 | + && mkdir nu-latest && tar xvf nu-*.tar.gz --directory=nu-latest \ |
| 40 | + && cp -aR nu-latest/**/* /usr/bin/ \ |
| 41 | + # Setup default config file for nushell |
| 42 | + && cd /home/nushell/.config/nushell \ |
| 43 | + && chmod +x /usr/bin/nu \ |
| 44 | + && chown -R nushell:nushell /home/nushell/.config/nushell \ |
| 45 | + # Reset Nushell config to default |
| 46 | + && su -c 'config reset -w' nushell \ |
| 47 | + && ls /usr/bin/nu_plugin* \ |
| 48 | + | xargs -I{} su -c 'plugin add {}' nushell \ |
| 49 | + && rm -rf /tmp/* |
| 50 | + |
| 51 | +USER nushell |
| 52 | + |
| 53 | +WORKDIR /home/nushell |
| 54 | + |
| 55 | +ENTRYPOINT ["nu"] |
0 commit comments