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

Docker compose setup #215

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,24 @@ After you've completed the set up steps, you can run the tests locally with
$ pytest
```

### Docker-compose setup
Docker installation guide can be found [here](https://docs.docker.com/engine/install/)
In short - all standard docker-compose commands can be used, but we also have some as shortcuts in [Makefile](Makefile).
```bash
make start
```
To run hello world example:
```bash
make hello-world
```
To run tests:
```bash
make test
```
To stop the image:
```bash
make stop
```
### CI and Releases

The CI for this project does a few different things:
Expand Down
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM python:3.11

RUN apt-get update && apt-get install -y \
build-essential \
curl
# Get Rust
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y

ENV PATH="/root/.cargo/bin:${PATH}"

RUN curl https://wasmtime.dev/install.sh -sSf | bash

COPY . /code/wasmtime-py
WORKDIR /code/wasmtime-py
RUN rustup target add wasm32-unknown-unknown wasm32-wasi && \
cargo install wasm-tools


RUN python ci/download-wasmtime.py && \
python ci/build-rust.py && \
pip install -e .[testing]
CMD sleep infinity
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
start:
docker-compose up -d
test:
docker-compose exec -it app pytest
hello-world:
docker-compose exec -it app python examples/hello.py
exec:
docker-compose exec -it app bash
stop:
docker-compose down
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3.8"
services:
app:
build: .
volumes:
- .:/code/wasmtime-py
- /code/wasmtime-py/wasmtime/linux-x86_64
- /code/wasmtime-py/wasmtime/bindgen/generated
working_dir: /code/wasmtime-py