Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: drop PublishTrimmed from binary dist #31

Merged
merged 4 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM alpine
RUN apk --no-cache add curl gcc icu

RUN if [ "$(uname -m)" = "aarch64" ]; then \
export BINARY_ARCH=arm64; \
elif [ "$(uname -m)" = "x86_64" ]; then \
export BINARY_ARCH=x64; \
else \
echo unsupported arch "$(uname -m)"; \
exit 1; \
fi && \
curl -LO https://github.com/smartbear-devrel/explore-cli/releases/download/0.6.0/explore-cli-linux-musl-$BINARY_ARCH.gz && \
gunzip explore-cli-linux-musl-$BINARY_ARCH.gz && \
chmod +x explore-cli-linux-musl-$BINARY_ARCH && \
mv explore-cli-linux-musl-$BINARY_ARCH /usr/local/bin/explore-cli && \
rm -rf explore-cli-linux-musl-$BINARY_ARCH.gz
ENTRYPOINT [ "explore-cli" ]
17 changes: 17 additions & 0 deletions Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM debian:12-slim
RUN apt update && apt install -y curl libicu-dev

RUN if [ "$(uname -m)" = "aarch64" ]; then \
export BINARY_ARCH=arm64; \
elif [ "$(uname -m)" = "x86_64" ]; then \
export BINARY_ARCH=x64; \
else \
echo unsupported arch "$(uname -m)"; \
exit 1; \
fi && \
curl -LO https://github.com/smartbear-devrel/explore-cli/releases/download/0.6.0/explore-cli-linux-$BINARY_ARCH.gz && \
gunzip explore-cli-linux-$BINARY_ARCH.gz && \
chmod +x explore-cli-linux-$BINARY_ARCH && \
mv explore-cli-linux-$BINARY_ARCH /usr/local/bin/explore-cli && \
rm -rf explore-cli-linux-$BINARY_ARCH.gz
ENTRYPOINT [ "explore-cli" ]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RIDS = "linux-x64" "linux-arm64" "linux-musl-x64" "linux-musl-arm64" "osx-x64" "
build: clean
for rid in $(RIDS); do \
echo "Building for $$rid..."; \
dotnet publish -c Release -p:PublishSingleFile=true -p:SelfContained=true -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:StaticLink=true -r $$rid -o bin/$(APP_NAME)-$$rid; \
dotnet publish -c Release -p:PublishSingleFile=true -p:SelfContained=true -p:PublishReadyToRun=true -p:StaticLink=true -r $$rid -o bin/$(APP_NAME)-$$rid; \
done || true

# the above true condition is a yak shave,
Expand Down
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,54 @@ Standalone releases of the Explore.CLI tool are published to GitHub Releases.

###### Debian

`apt update && apt install -y libicu`
`apt update && apt install -y libicu-dev`

#### Docker

Dockerfiles are provided for amd64 & arm64 flavours

- Alpine
- `./Dockerfile.alpine`
- Debian
- `./Dockerfile.debian`

##### Building images

```sh
docker build . --platform=linux/arm64 -f Dockerfile.debian -t explore-cli:debian-arm64
docker build . --platform=linux/arm64 -f Dockerfile.debian -t explore-cli:debian-amd64
docker build . --platform=linux/arm64 -f Dockerfile.alpine -t explore-cli:alpine-arm64
docker build . --platform=linux/arm64 -f Dockerfile.alpine -t explore-cli:alpine-amd64
```

##### Using images

The `entrypoint` is the `explore-cli` application.

Set environment variables in your shell

```sh
export EXPLORE_SESSION_TOKEN=<SESSION_TOKEN>
export EXPLORE_XSRF_TOKEN=<XSRF-TOKEN>
```

Run your created docker image, with your required explore-cli command.

In our example we are using `import-spaces` which we have in our local directory under the `spaces` folder.

The `spaces` folder is volume mounted into our container in `/spaces`, and commands to file paths should
reference this folder.

```sh
docker run --platform=linux/amd64 \
--rm \
-it \
-v $PWD/spaces:/spaces \
explore-cli:debian \
import-spaces \
--explore-cookie "SESSION=${EXPLORE_SESSION_TOKEN}; XSRF-TOKEN=${EXPLORE_XSRF_TOKEN}" \
-fp /spaces/explore_demo_spaces.json
```

### Session Cookies for CLI command

Expand Down
Loading