Skip to content

Commit

Permalink
Feature/add base image (#163)
Browse files Browse the repository at this point in the history
- Add `swakny-base` image Dockerfile and a readme with instructions.
- add devcontainer.json using the swanky-base image
  • Loading branch information
codespool committed May 23, 2023
1 parent a24837c commit 9cf79b7
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "swanky-env",
"image": "ghcr.io/astarnetwork/swanky-cli/swanky-base:swanky2.2.3_v1.1.4",

// Mount the workspace volume
"mounts": ["source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached"],
"workspaceFolder": "/workspace",

"containerEnv": {
"CARGO_TARGET_DIR": "/tmp"
},

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": ["esbenp.prettier-vscode", "dtsvet.vscode-wasm", "redhat.vscode-yaml"]
}
},

"remoteUser": "root"
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -214,5 +214,6 @@ oclif.manifest.json

packages/cli/test_project/**/*
packages/cli/temp_project/**/*
packages/cli/temp_proj/**/*

packages/cli/tmp/**/*
42 changes: 42 additions & 0 deletions packages/base-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Start from the base image
FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/base:ubuntu-22.04

LABEL org.opencontainers.image.source=https://github.com/AstarNetwork/swanky-cli

# Update the package lists
RUN apt-get update

# Install Node.js
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs

# Install binaryen, pkg-config, and libssl-dev
RUN apt-get install -y binaryen pkg-config libssl-dev

# Download and install swanky-cli and verify the installation
RUN curl -L https://github.com/AstarNetwork/swanky-cli/releases/download/v2.2.3/swanky-v2.2.3-b7052fb-linux-x64.tar.gz | tar xz -C /opt && \
ln -s /opt/swanky/bin/swanky /usr/local/bin/swanky

# Install Rustup and Rust, additional components, packages, and verify the installations
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
/bin/bash -c "source $HOME/.cargo/env && \
rustup toolchain install nightly-2023-02-07 && \
rustup default nightly-2023-02-07 && \
rustup component add rust-src --toolchain nightly-2023-02-07 && \
rustup target add wasm32-unknown-unknown --toolchain nightly-2023-02-07 && \
cargo install cargo-dylint dylint-link && \
cargo install cargo-contract --force --version 2.1.0 && \
rustc --version"

# Install Yarn 1.x
RUN npm install -g yarn@1

# Verify installations
RUN node --version && \
wasm-opt --version && \
pkg-config --version && \
openssl version && \
swanky --version && \
yarn --version

# Clean up the package lists to reduce image size
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
27 changes: 27 additions & 0 deletions packages/base-image/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Building and publishing the image

### Build the image:

```
docker build -t swanky-base .
```

### Tag it with swanky version used, and it's own version:

```
docker tag [IMAGE_NAME] ghcr.io/astarnetwork/swanky-cli/swanky-base:swanky[X.X.X]_v[X.X.X]
```

Example:

```
docker tag swanky-base ghcr.io/astarnetwork/swanky-cli/swanky-base:swanky2.2.2_v1.1.4
```

### Push to repo:

Use the same tag created in the previous step

```
docker push ghcr.io/astarnetwork/swanky-cli/swanky-base:swanky2.2.3_v1.1.4
```

0 comments on commit 9cf79b7

Please sign in to comment.