Commit graph

55 commits

Author SHA1 Message Date
Kieron Wilkinson
d575fd1c3a
Tests for new Alpine and Debian image builds (#14225) 2024-11-01 07:45:20 +08:00
Justin Ma
4200df21d3
Add RELEASE_QUERY_API build arg for Dockerfiles (#14209)
<!--
if this PR closes one or more issues, you can automatically link the PR
with
them by using one of the [*linking
keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword),
e.g.
- this PR should close #xxxx
- fixes #xxxx

you can also mention related issues, PRs or discussions!
-->

# Description
<!--
Thank you for improving Nushell. Please, check our [contributing
guide](../CONTRIBUTING.md) and talk to the core team before making major
changes.

Description of your pull request goes here. **Provide examples and/or
screenshots** if your changes affect the user experience.
-->

Add `RELEASE_QUERY_API` build arg for all Dockerfiles, with default
value set to
`https://api.github.com/repos/nushell/nushell/releases/latest`, So that
we can build the nightly images with the same Dockerfile but a different
`RELEASE_QUERY_API` build arg.

A nightly image build with the new Dockerfile could be found here:
https://github.com/orgs/nushell/packages/container/nushell/297473460?tag=nightly

# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->

The default behavior keep the same as before

# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->

Those who want to build a docker image with the nushell nightly release
installed could run:
```nu
let queryApi = http get https://api.github.com/repos/nushell/nightly/releases | sort-by -r created_at | get 0.url
docker buildx build --build-arg $'RELEASE_QUERY_API=($queryApi)' ...
```
2024-10-30 06:45:15 -05:00
Kieron Wilkinson
3ec76af96e
Add Debian Dockerfile (#14193)
# Description

Add Dockerfile for Debian/Ubuntu images.
Related to #14171 and PR #14191

This is largely similar to the Alpine version, however there are some
minor differences:
- I've specially added Debian Bookworm here to provide some stability
when new major versions are released. We can bump the (LTS only perhaps)
versions supported as needed.
- I moved the creation of the nushell user until later to avoid a
warning about the nu binary not (yet) being available.
- Debian doesn't come with wget or curl. I've added wget to be similar
to Alpine. I tried creating a multi-layer version to avoid installing
wget (reduced attack surface) but the image was bigger due to the extra
layer, so didn't seem worth being different.

I can transfer the relevant changes to the Alpine image if we want to
keep them easily diffable?

# User-Facing Changes

While this provides a Debian image by default. An Ubuntu image can be
created from this by changing to `FROM ubuntu:noble`. We could later
supply that as an optional argument from the build workflow to be able
to build different distros and supported versions.

# Tests + Formatting

The images produced for Debian/Ubuntu are ~75Mb bigger as listed in
`docker images`:

```
REPOSITORY                                       TAG             IMAGE ID       CREATED        SIZE
nu-alpine                                        latest          71c0216eddd9   44 years ago   167MB
nu-debian                                        latest          cce3d91fc77c   44 years ago   243MB
nu-ubuntu                                        latest          ce90497da806   44 years ago   240MB
```

I've tested a few nu commands, including polars. It seems to work okay.
It makes sense to add some container-based tests once the workflows are
available. I'll probably pick that up later when @hustcer has completed
the migration of his workflows. Perhaps invoking a nushell-based test
suite if one is available. The toolkit seems to rely on cargo and the
source being available, which of course won't work here.
2024-10-29 20:40:23 +08:00
Justin Ma
8c2e12ad79
Update the dockerfile for alpine image (#14191)
<!--
if this PR closes one or more issues, you can automatically link the PR
with
them by using one of the [*linking
keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword),
e.g.
- this PR should close #xxxx
- fixes #xxxx

you can also mention related issues, PRs or discussions!
-->

# Description
<!--
Thank you for improving Nushell. Please, check our [contributing
guide](../CONTRIBUTING.md) and talk to the core team before making major
changes.

Description of your pull request goes here. **Provide examples and/or
screenshots** if your changes affect the user experience.
-->

Update the dockerfile for alpine image, related
https://github.com/nushell/nushell/issues/14171 :

1.  Add armv7 arch support
2. Add more opencontainers labels, see:
https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys

# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->

- Nushell docker images will be provided for each official release
- There will be a `nushell:nightly` tag for the latest nightly release

# After Submitting

1. The workflow that build the images will be provided in
[nushell/nightly](https://github.com/nushell/nightly) repo later
2. Alpine image will be provided as the default, we may also add Debian
images later
2024-10-29 06:32:09 -05:00
Justin Ma
02804ab537
Simplify the Dockerfile (#13974)
<!--
if this PR closes one or more issues, you can automatically link the PR
with
them by using one of the [*linking
keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword),
e.g.
- this PR should close #xxxx
- fixes #xxxx

you can also mention related issues, PRs or discussions!
-->

# Description

Works for `docker build` and `docker buildx build`
For more detail about the new Dockerfile syntax:
https://www.docker.com/blog/new-dockerfile-capabilities-v1-7-0/
2024-10-01 06:28:14 -05:00
Saurabh Shinde
0c72f881a6
Fix Docker image build failure (#13938)
## Description
While building the docker image under `nushell/docker` directory,
following build failure observed.


![nushell-docker-error](https://github.com/user-attachments/assets/972048d7-b001-4325-b947-93e95b98f4d1)

The problem here is the following lines of code that decide which
`nushell` binary to download, extract, and install
https://github.com/nushell/nushell/blob/main/docker/Dockerfile#L16-L19

The issue is especially with wildcard asterisk (*) which downloads both
`amd64` and `arm64` binary while building.

## Fix
Introduced build arg `TARGETARCH` which will be populated implicitly by
docker `build/buildx` which will help us to decide which binary to
download.

## User-Facing Changes
None. 

## Testing Details
Tested building docker image on both `amd64` and `arm64` systems.
**amd64/x86_64**

![nushell-docker-amd64](https://github.com/user-attachments/assets/ea30b7e3-0664-4a5b-bb13-4c18cdae2a31)

**arm64**

![nushell-docker-arm64](https://github.com/user-attachments/assets/54e47051-1ee7-4695-bc6c-1e211532a545)
2024-09-26 09:57:37 -05:00
Justin Ma
c9cb62067c
Fix dockerfile and reset Nu config to default (#13851)
<!--
if this PR closes one or more issues, you can automatically link the PR
with
them by using one of the [*linking
keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword),
e.g.
- this PR should close #xxxx
- fixes #xxxx

you can also mention related issues, PRs or discussions!
-->

# Description

Fix dockerfile and reset Nu config to default, fetching config file from
the remote may cause compatible issues
2024-09-15 20:03:22 +08:00
Andy Gayton
b27cd70fd1
remove the deprecated register command (#13297)
# Description

This PR removes the `register` command which has been
[deprecated](https://www.nushell.sh/blog/2024-04-30-nushell_0_93_0.html#register-toc)
in favor of [`plugin
add`](https://www.nushell.sh/blog/2024-04-30-nushell_0_93_0.html#redesigned-plugin-management-commands-toc)

# User-Facing Changes

`register` is no longer available
2024-07-05 07:16:50 -05:00
Justin Ma
b03ef56bcb
Fix alpine docker file (#10992)
<!--
if this PR closes one or more issues, you can automatically link the PR
with
them by using one of the [*linking
keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword),
e.g.
- this PR should close #xxxx
- fixes #xxxx

you can also mention related issues, PRs or discussions!
-->

# Description

Fix docker file. For more detail see:
https://github.com/nushell/nushell/issues/8307
2023-11-08 06:30:34 -06:00
Reilly Wood
f94df58486
Fix cross-compiling with cross-rs (#9972)
I cross-compiled Nushell (from x64 to ARM64) for the first time in a
while and noticed that our [`cross-rs`](https://github.com/cross-rs)
setup was no longer working. I've fixed that by following [the latest
`cross-rs`
docs](https://github.com/cross-rs/cross/wiki/Recipes#openssl).
2023-08-09 22:08:35 -07:00
Yethal
b44926d597
Pre-register plugins inside docker container (#9533)
<!--
if this PR closes one or more issues, you can automatically link the PR
with
them by using one of the [*linking
keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword),
e.g.
- this PR should close #xxxx
- fixes #xxxx

you can also mention related issues, PRs or discussions!
-->

# Description
<!--
Thank you for improving Nushell. Please, check our [contributing
guide](../CONTRIBUTING.md) and talk to the core team before making major
changes.

Description of your pull request goes here. **Provide examples and/or
screenshots** if your changes affect the user experience.
-->
Plugins bundled with nushell will be kept inside docker container and
preregistered
# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->

# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library

> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->

# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
2023-06-28 13:04:32 -05:00
Reilly Wood
216d7d035f
Add cross-rs config (#7559)
Cross-compiling Nu can be a little tricky due to dependencies. This PR
makes it easy to use [`cross-rs`](https://github.com/cross-rs/cross), a
popular tool for cross-compiling Rust code using Docker:
```bash
cross build --target aarch64-unknown-linux-musl --release
```

I find this useful for compiling ARM binaries from x64. Easy to add more
target triples later as needed.
2022-12-22 08:52:07 -06:00
metacoma
7e2781a2af
fix docker build (#7422)
# Description

Docker build fails with the latest release 0.72.1
```bash
Sending build context to Docker daemon  3.072kB
Step 1/6 : FROM alpine
 ---> 49176f190c7e
Step 2/6 : LABEL maintainer=nushell
 ---> Using cache
 ---> 7afa6864f008
Step 3/6 : RUN echo '/usr/bin/nu' >> /etc/shells     && adduser -D -s /usr/bin/nu nushell     && mkdir -p /home/nushell/.config/nushell/     && wget -q https://raw.githubusercontent.com/nushell/nushell/main/crates/nu-utils/src/sample_config/default_config.nu -O /home/nushell/.config/nushell/config.nu     && wget -q https://raw.githubusercontent.com/nushell/nushell/main/crates/nu-utils/src/sample_config/default_env.nu -O /home/nushell/.config/nushell/env.nu     && cd /tmp     && wget -qO - https://api.github.com/repos/nushell/nushell/releases/latest     |grep browser_download_url     |grep musl     |cut -f4 -d '"'     |xargs -I{} wget {}     && tar -xzf nu*     && chmod +x nu     && mv nu /usr/bin/nu     && chown -R nushell:nushell /home/nushell/.config/nushell     && rm -rf /tmp/*
 ---> Running in fa544239a3ea
Connecting to github.com (140.82.121.4:443)
Connecting to objects.githubusercontent.com (185.199.108.133:443)
saving to 'nu-0.72.1-x86_64-unknown-linux-musl.tar.gz'
nu-0.72.1-x86_64-unk   3% |*                               |  552k  0:00:29 ETA
nu-0.72.1-x86_64-unk  93% |*****************************   | 15.2M  0:00:00 ETA
nu-0.72.1-x86_64-unk 100% |********************************| 16.2M  0:00:00 ETA
'nu-0.72.1-x86_64-unknown-linux-musl.tar.gz' saved
chmod: nu: No such file or directory
```
2022-12-10 09:22:23 -06:00
pwygab
01386f4d58
adds a config reset command (#6149)
* moves config files to nu_utils

* fmt

* fix dockerfile

* fix docs
2022-07-31 20:44:33 -05:00
Yethal
6ee13126f7
Update Dockerfile (#5910)
Container now uses unpriviledged user with UID 1000 by default
Container now uses Alpine as base
Final image size dropped to just 67MB
2022-06-29 18:36:24 -05:00
Justin Ma
848ff8453b
feat: Update dockerfile for latest nu release (#5843) 2022-06-21 18:28:31 +08:00
Justin Ma
257290acc2
Add a dockerfile example based on debian bullseye-slim (#5176)
* feat: add nu dockerfile, based on debian bullseye

* use aria2 instead of wget for bad network

* some small fix
2022-04-13 14:48:54 +03:00
JT
cdc8e67d61
Remove unused repo parts (#4271)
* Remove unused repo parts

* Update README

* cargo fmt
2022-01-26 07:31:04 +11:00
Jonathan Turner
6951fb440c
Remove it expansion (#2701)
* Remove it-expansion, take 2

* Cleanup

* silly update to test CI
2020-10-26 19:55:52 +13:00
Ryuichi Watanabe
de5cd4ec23
Fix Dockerfile (cache clear of apt) (#2394) 2020-08-24 05:24:49 +12:00
Joseph T. Lyons
053bd926ec
First pass at updating all documentation formatting and cleaning up output of examples (#2031) 2020-06-24 06:21:47 +12:00
Waldir Pimenta
5ca9e12b7f
Fix whitespace and typos (#1481)
* Remove EOL whitespace in files other than docs

* Break paragraphs into lines

See http://rhodesmill.org/brandon/2012/one-sentence-per-line/ for the rationale

* Fix various typos

* Remove EOL whitespace in docs/commands/*.md
2020-03-14 06:23:41 +13:00
Jason Gedge
b2c5af457e
Move most of the root package into a subcrate. (#1445)
This improves incremental build time when working on what was previously
the root package. For example, previously all plugins would be rebuilt
with a change to `src/commands/classified/external.rs`, but now only
`nu-cli` will have to be rebuilt (and anything that depends on it).
2020-03-04 13:58:20 -05:00
Jonathan Turner
11e4410d1c
Merge pull request #806 from DrSensor/ci/github/quay.io
ci(github): replace docker.pkg.github.com with quay.io
2019-11-12 12:03:00 +13:00
Fahmi Akbar Wildana
7cf3c6eb95
Move env declaration to jobs.docker 2019-11-11 07:51:41 +07:00
Jonathan Turner
c42d97fb97 try again 2019-11-08 08:00:46 +13:00
Jonathan Turner
13314ad1e7 try again 2019-11-08 07:54:52 +13:00
Jonathan Turner
1cca5557b1 Second attempt to remove rust-toolchain 2019-11-08 07:27:39 +13:00
Jonathan Turner
c01b602b86
Update docker to stable 2019-11-08 06:34:53 +13:00
Vanessa Sochat
64345b2985
dont run nu at end of release build
Signed-off-by: Vanessa Sochat <vsochat@stanford.edu>
2019-09-29 17:18:35 -04:00
Jonathan Turner
f99d38ead4
Merge pull request #625 from DrSensor/master
Publish various docker image on git-tag
2019-09-24 05:10:47 +12:00
Jonathan Turner
8d5b1ad233
Merge pull request #656 from jankoprowski/debian
Introduce debian packaging
2019-09-20 06:34:29 +12:00
Jan Koprowski
a96836facb Use tags instead container id and add all binaries to debian/install 2019-09-19 17:57:36 +02:00
Jan Koprowski
85a5ed70b1 Replace command with <image-id> 2019-09-19 08:16:39 +02:00
Jan Koprowski
a8e2801e0b Enhance docker/packaging/README.md about issue links 2019-09-18 17:43:06 +02:00
Jan Koprowski
c9310265fe Remove Dockerfile.bionic from docker directory 2019-09-18 17:04:31 +02:00
Jan Koprowski
4ad249694f Base on quay.io/nushell/nu-base:latest image 2019-09-16 19:55:53 +02:00
Vanessa Sochat
579c7ff6d6
updating base to 18.04
Signed-off-by: Vanessa Sochat <vsochat@stanford.edu>
2019-09-13 08:46:52 -04:00
Jan Koprowski
a215997dcd Introduce debian packaging 2019-09-12 19:59:40 +02:00
Vanessa Sochat
6fe211fdbe
changing base image to use updated libssl, adding tests to run --help for nu
Signed-off-by: Vanessa Sochat <vsochat@stanford.edu>
2019-09-12 12:46:16 -04:00
Vanessa Sochat
1f3f3d3105
adding missing docker dependencies openssl and pkgconfig
Signed-off-by: Vanessa Sochat <vsochat@stanford.edu>
2019-09-11 13:44:23 -04:00
Fahmi Akbar Wildana
9dc58247e5 Fix wrong patch on glibc-busybox
because distroless/cc doesn't contain libz
2019-09-11 23:49:11 +07:00
Fahmi Akbar Wildana
62e6cc4dae
Add libgcc_s.so.1 for glibc-busybox 2019-09-11 09:38:22 +07:00
Fahmi Akbar Wildana
095e5ac69f
Add librt.so.1 for glibc-busybox 2019-09-11 09:10:38 +07:00
Fahmi Akbar Wildana
149ccc4fd3
Fix glibc-{busybox,distroless}
* Add libdl.so.2 for glibc-busybox

* Change base-image of glibc-distroless to gcr.io/distroless/cc
2019-09-11 06:41:37 +07:00
Fahmi Akbar Wildana
0ca7aaa56f
Add libz for glibc-{busybox,distroless}
Signed-off-by: Fahmi Akbar Wildana <f.a.wildana@gmail.com>
2019-09-09 16:45:55 +07:00
Fahmi Akbar Wildana
d900d8b4c7
Fix can't execute entrypoint
Signed-off-by: Fahmi Akbar Wildana <f.a.wildana@gmail.com>
2019-09-09 05:41:58 +07:00
Fahmi Akbar Wildana
99d5dae83a
Fix artifact is missing
Signed-off-by: Fahmi Akbar Wildana <f.a.wildana@gmail.com>
2019-09-09 04:20:08 +07:00
Vanessa Sochat
24ba0d93c7
test building akin to azure-pipelines (without release) to hopefully shorten circleci builds
Signed-off-by: Vanessa Sochat <vsochat@stanford.edu>
2019-09-08 15:44:52 -04:00
Fahmi Akbar Wildana
21896b200c Add busybox as base image 2019-09-08 22:31:10 +07:00