-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added images for almost all languages
- Loading branch information
1 parent
1ebe47f
commit a7c5208
Showing
15 changed files
with
299 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM docker.io/anihex/wasm4:2.1.0-base | ||
|
||
RUN npm install --global assemblyscript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
ARG WASI_VERSION=14 | ||
|
||
FROM docker.io/archlinux:latest | ||
|
||
WORKDIR /cart | ||
|
||
RUN pacman -Syu --noconfirm npm make \ | ||
&& \ | ||
npm install --global wasm4 binaryen | ||
|
||
ENTRYPOINT [ "w4" ] | ||
CMD [ "watch" ] | ||
|
||
EXPOSE 4444 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
ARG WASI_VERSION=14 | ||
|
||
FROM docker.io/anihex/wasm4:2.1.0-base AS downloader | ||
|
||
WORKDIR /setup | ||
|
||
ARG WASI_VERSION | ||
ENV WASI_VERSION=$WASI_VERSION | ||
ENV WASI_VERSION_FULL=${WASI_VERSION}.0 | ||
|
||
RUN pacman -Syu --noconfirm curl | ||
|
||
RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz --output wasi-sdk.tar.gz && \ | ||
tar -xf wasi-sdk.tar.gz | ||
|
||
|
||
|
||
FROM docker.io/anihex/wasm4:2.1.0-base AS final | ||
|
||
WORKDIR /cart | ||
|
||
ARG WASI_VERSION | ||
ENV WASI_VERSION=$WASI_VERSION | ||
ENV WASI_VERSION_FULL=${WASI_VERSION}.0 | ||
ENV WASI_SDK_PATH=/opt/wasi-sdk | ||
|
||
COPY --from=downloader /setup/wasi-sdk-${WASI_VERSION_FULL} /opt/wasi-sdk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM docker.io/anihex/wasm4:2.1.0-c | ||
|
||
RUN pacman -Syu --noconfirm ldc dub lld |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM docker.io/archlinux:latest AS downloader | ||
|
||
WORKDIR /setup | ||
|
||
RUN pacman -Syu --noconfirm curl | ||
|
||
RUN curl -L https://github.com/tinygo-org/tinygo/releases/download/v0.21.0/tinygo0.21.0.linux-amd64.tar.gz --output tinygo.tar.gz && \ | ||
tar -xf tinygo.tar.gz | ||
|
||
|
||
|
||
FROM docker.io/anihex/wasm4:2.1.0-base | ||
|
||
RUN pacman -Syu --noconfirm go | ||
|
||
COPY --from=downloader /setup/tinygo /opt/tinygo | ||
|
||
ENV PATH="/opt/tinygo/bin:${PATH}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM docker.io/archlinux:latest AS downloader | ||
|
||
WORKDIR /setup | ||
|
||
RUN pacman -Syu --noconfirm git curl base-devel gcc gdb llvm11 clang | ||
|
||
RUN git clone https://github.com/edubart/nelua-lang.git && \ | ||
cd nelua-lang && \ | ||
make | ||
|
||
|
||
|
||
# Step 3: Install and configure compilers | ||
FROM docker.io/anihex/wasm4:2.1.0-c | ||
|
||
COPY --from=downloader /setup/nelua-lang/nelua /opt/nelua/nelua | ||
COPY --from=downloader /setup/nelua-lang/nelua-lua /opt/nelua/nelua-lua | ||
COPY --from=downloader /setup/nelua-lang/lib /opt/nelua/lib | ||
COPY --from=downloader /setup/nelua-lang/lualib /opt/nelua/lualib | ||
|
||
ENV PATH="/opt/nelua:${PATH}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM docker.io/anihex/wasm4:2.1.0-c | ||
|
||
RUN pacman -Syu --noconfirm nim nimble |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM docker.io/archlinux:latest AS downloader | ||
|
||
WORKDIR /setup | ||
|
||
RUN pacman -Syu --noconfirm unzip | ||
|
||
RUN curl -L https://github.com/odin-lang/Odin/releases/download/dev-2021-12/odin-ubuntu-amd64-dev-2021-12.zip --output odin.zip && \ | ||
unzip odin.zip && \ | ||
mv ubuntu_artifacts odin && \ | ||
chmod +x odin/odin | ||
|
||
|
||
|
||
FROM docker.io/anihex/wasm4:2.1.0-c | ||
|
||
COPY --from=downloader /setup/odin/odin /opt/odin/odin | ||
COPY --from=downloader /setup/odin/core /opt/odin/core | ||
COPY --from=downloader /setup/odin/shared /opt/odin/shared | ||
|
||
RUN pacman -Syu --noconfirm llvm11 lld \ | ||
&& \ | ||
ln -s /usr/lib/libLLVM-11.so /usr/lib/libLLVM-11.so.1 | ||
|
||
ENV PATH="/opt/odin:${PATH}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM docker.io/anihex/wasm4:2.1.0-c | ||
|
||
RUN pacman -Syu --noconfirm rustup \ | ||
&& \ | ||
rustup update stable && rustup target add wasm32-unknown-unknown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM docker.io/anihex/wasm4:2.1.0-c | ||
|
||
RUN pacman -Syu --noconfirm zig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,46 @@ | ||
# wasm4-docker | ||
# wasm4 | ||
|
||
Dockerfile to create a docker image than compiles AssemblyScript, C, Go, Rust and Zig | ||
Docker image to create and develop games for the Fantasy Console [WASM-4](https://wasm4.org/). | ||
|
||
Build by running `docker build --rm -t wasm4 .` | ||
## Image variants: anihex/wasm4:<VERSION>-<VARIANT> | ||
|
||
Due to the size of the resulting image, it's not recommended to use this on PCs with little space. | ||
All variants include the following tools: | ||
- The `w4` CLI | ||
- Binaryen (`wasm-opt` etc) | ||
|
||
## Usage | ||
Aside from that, there currently there are the following variants: `full`, `assemblyscript`, `c`, `d`, `go`, `nelua`, `nim`, `odin`, `rust` and `zig`. | ||
|
||
### Creating a project | ||
Almost all variants include the C-variant. Exceptions are `assemblyscript` and `go`. | ||
|
||
This image comes with wasm4 in version 2.1.0. Therefore the following languages are currently supported: | ||
Examples: | ||
```shell | ||
docker pull anihex/wasm4:2.1.0-full | ||
docker pull anihex/wasm4:2.1.0-c | ||
docker pull anihex/wasm4:latest # Implicit full-variant | ||
docker pull anihex/wasm4:go | ||
``` | ||
|
||
## Usage | ||
|
||
- AssemblyScript (`--as or --assemblyscript`) | ||
- C (`--c`) | ||
- D (`--d`) | ||
- Go (`--go`) | ||
- Nelua (`--nelua`) | ||
- Nim (`--nim`) | ||
- Odin (`--odin`) | ||
- Rust (`--rs or --rust`) | ||
- WebAssembly Text (`--wat`) | ||
- Zig (`--zig`) | ||
The default command is `w4 watch`. This can be changed by overriding the command. If a completely different command is required, the entrypoint needs to be overridden. | ||
|
||
The command to initialize a project is `w4 init <LANGUAGE>` | ||
Examples: | ||
|
||
```shell | ||
docker run --rm -v $PWD:/cart wasm4 init --c | ||
docker run --rm -v $PWD:/cart -p 4444:4444 anihex/wasm4:latest # Starts the watcher in the current directory | ||
docker run --rm -v $PWD:/cart anihex/wasm4:latest new --c hello-c # Creates a new project called hello-c | ||
docker run --rm -it $PWD:/cart -entrypoint bash anihex/wasm4:latest # Starts the bash-terminal | ||
``` | ||
|
||
To create a new subfolder, use `w4 new <LANGUAGE>` instead of `w4 init <LANGUAGE>` | ||
## Ports | ||
|
||
### Watching a project | ||
The default port is 4444. For examples, look at `Usage`. | ||
|
||
```shell | ||
docker run --rm -v $PWD:/cart -p 4444:4444 wasm4 | ||
``` | ||
## Mounts | ||
|
||
The standard-mountpoint is `/cart`. For examples, look at `Usage`. | ||
|
||
## Contributing | ||
|
||
## TODO | ||
|
||
- [X] Install AssemblyScript | ||
- [X] Install C | ||
- [X] Install D | ||
- [X] Install Go and TinyGo | ||
- [X] Install Nelua | ||
- [X] Install Nim | ||
- [X] Install Odin | ||
- [X] Install Rust | ||
- [ ] Install WABT | ||
- [X] Install Zig | ||
WASM-4 is OpenSource and is hosted on GitHub: https://github.com/aduros/wasm4<br> | ||
The docker-files for this can be found on https://github.com/christopher-kleine/wasm4-docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Hello-WASM4 | ||
|
||
This folder contains two docker-compose files to test the current versions of the WASM4 docker images. | ||
|
||
## Usage | ||
|
||
```shell | ||
# First create the projects | ||
docker-compose -f docker-compose.create.yml up | ||
|
||
# Stop docker-compose and change the permissions | ||
docker-compose -f docker-compose.create.yml down | ||
sudo chown -R $USER: hello-* | ||
|
||
# Start the watch process | ||
docker-compose -f docker-compose.watch.yml up -d | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
services: | ||
as: | ||
image: anihex/wasm4:2.1.0-assemblyscript | ||
volumes: | ||
- ./:/cart | ||
command: ["new", "--as", "hello-as"] | ||
|
||
c: | ||
image: anihex/wasm4:2.1.0-c | ||
volumes: | ||
- ./:/cart | ||
command: ["new", "--c", "hello-c"] | ||
|
||
d: | ||
image: anihex/wasm4:2.1.0-d | ||
volumes: | ||
- ./:/cart | ||
command: ["new", "--d", "hello-d"] | ||
|
||
go: | ||
image: anihex/wasm4:2.1.0-go | ||
volumes: | ||
- ./:/cart | ||
command: ["new", "--go", "hello-go"] | ||
|
||
nelua: | ||
image: anihex/wasm4:2.1.0-nelua | ||
volumes: | ||
- ./:/cart | ||
command: ["new", "--nelua", "hello-nelua"] | ||
|
||
nim: | ||
image: anihex/wasm4:2.1.0-nim | ||
volumes: | ||
- ./:/cart | ||
command: ["new", "--nim", "hello-nim"] | ||
|
||
odin: | ||
image: anihex/wasm4:2.1.0-odin | ||
volumes: | ||
- ./:/cart | ||
command: ["new", "--odin", "hello-odin"] | ||
|
||
rust: | ||
image: anihex/wasm4:2.1.0-rust | ||
volumes: | ||
- ./:/cart | ||
command: ["new", "--rust", "hello-rust"] | ||
|
||
# wat: | ||
# image: anihex/wasm4:2.1.0-wat | ||
# volumes: | ||
# - ./:/cart | ||
# command: ["new", "--rust", "hello-wat"] | ||
|
||
zig: | ||
image: anihex/wasm4:2.1.0-zig | ||
volumes: | ||
- ./:/cart | ||
command: ["new", "--zig", "hello-zig"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
services: | ||
as: | ||
image: anihex/wasm4:2.1.0-assemblyscript | ||
ports: | ||
- 4440:4444 | ||
volumes: | ||
- ./hello-as:/cart | ||
|
||
c: | ||
image: anihex/wasm4:2.1.0-c | ||
ports: | ||
- 4441:4444 | ||
volumes: | ||
- ./hello-c:/cart | ||
|
||
d: | ||
image: anihex/wasm4:2.1.0-d | ||
ports: | ||
- 4442:4444 | ||
volumes: | ||
- ./hello-d:/cart | ||
|
||
go: | ||
image: anihex/wasm4:2.1.0-go | ||
ports: | ||
- 4443:4444 | ||
volumes: | ||
- ./hello-go:/cart | ||
|
||
nelua: | ||
image: anihex/wasm4:2.1.0-nelua | ||
ports: | ||
- 4444:4444 | ||
volumes: | ||
- ./hello-nelua:/cart | ||
|
||
nim: | ||
image: anihex/wasm4:2.1.0-nim | ||
ports: | ||
- 4445:4444 | ||
volumes: | ||
- ./hello-nim:/cart | ||
|
||
odin: | ||
image: anihex/wasm4:2.1.0-odin | ||
ports: | ||
- 4446:4444 | ||
volumes: | ||
- ./hello-odin:/cart | ||
|
||
rust: | ||
image: anihex/wasm4:2.1.0-rust | ||
ports: | ||
- 4447:4444 | ||
volumes: | ||
- ./hello-rust:/cart | ||
|
||
# wat: | ||
# image: anihex/wasm4:2.1.0-wat | ||
# ports: | ||
# - 4448:4444 | ||
# volumes: | ||
# - ./hello-wat:/cart | ||
|
||
zig: | ||
image: anihex/wasm4:2.1.0-zig | ||
ports: | ||
- 4449:4444 | ||
volumes: | ||
- ./hello-zig:/cart |