second-state / microservice-rust-mysql

A template project for building a database-driven microservice in Rust and run it in the WasmEdge sandbox.
Apache License 2.0
350 stars 54 forks source link

docker-desktop cannot build it #12

Open fanspace opened 1 year ago

fanspace commented 1 year ago

docker desktop version : 图片

D:\gitpro\microservice-rust-mysql>docker compose up [+] Running 1/1 ! server Warning 21.0s [+] Building 15.8s (6/6) FINISHED => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 1.08kB 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => resolve image config for docker.io/docker/dockerfile:1 15.4s => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cf 0.0s => [internal] load .dockerignore 0.0s => [internal] load build definition from Dockerfile 0.0s failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = dockerfile parse error on line 6: unknown instruction: set (did you mean user?)

it works after modify like below

`FROM --platform=$BUILDPLATFORM rust:1.64 AS buildbase WORKDIR /src RUN apt-get update && apt-get install -y \ git \ clang \ && rustup target add wasm32-wasi

RUN curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash

FROM buildbase AS build COPY Cargo.toml orders.json update_order.json . COPY src ./src

RUN --mount=type=cache,target=/usr/local/cargo/git/db \ --mount=type=cache,target=/usr/local/cargo/registry/cache \ --mount=type=cache,target=/usr/local/cargo/registry/index \ cargo build --target wasm32-wasi --release

RUN /root/.wasmedge/bin/wasmedgec target/wasm32-wasi/release/order_demo_service.wasm order_demo_service.wasm

FROM scratch ENTRYPOINT [ "order_demo_service.wasm" ] COPY --from=build /src/order_demo_service.wasm /order_demo_service.wasm`

hydai commented 1 year ago

Hi @fanspace Please update to the latest docker-desktop and try again.

CleanShot 2023-06-19 at 16 43 32

And you will need an extra flag to workaround an issue: https://github.com/second-state/microservice-rust-mysql/commit/ac7bbed4db49ebdd18c044e4d3bdf6c51eebefa4

Then, docker compose up

CleanShot 2023-06-19 at 16 55 27

dierbei commented 1 year ago

I do it like this

image

rphuber commented 1 year ago

I can not build the container either. Even after using docker desktop with the containerd and wasm features enabled and using the correct env variable I get issues with either the container hanging when trying to build (and unable to cancel) or error response from the daemon: failed to create container: unknown.

CleanShot 2023-07-28 at 16 54 15@2x CleanShot 2023-07-28 at 16 54 38@2x CleanShot 2023-07-28 at 16 54 54@2x CleanShot 2023-07-28 at 16 59 48@2x

any ideas here?

hydai commented 1 year ago

Hi @rphuber Could you please try the latest master branch with the latest docker desktop? We fixed a DNS nameserver issue just a few hours ago.