-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
29,092 additions
and
0 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,2 @@ | ||
ui/node_modules | ||
vm/target |
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 @@ | ||
node_modules | ||
ui/build | ||
vm/target |
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,39 @@ | ||
FROM --platform=$BUILDPLATFORM rust AS wasm-builder | ||
WORKDIR /backend | ||
RUN rustup target add wasm32-wasi | ||
COPY vm/Cargo.toml ./ | ||
COPY vm/Cargo.lock ./ | ||
COPY vm/ ./ | ||
# build the wasm binary | ||
RUN cargo build --target wasm32-wasi --release | ||
|
||
FROM --platform=$BUILDPLATFORM node:17.7-alpine3.14 AS client-builder | ||
WORKDIR /ui | ||
# cache packages in layer | ||
COPY ui/package.json /ui/package.json | ||
COPY ui/package-lock.json /ui/package-lock.json | ||
RUN --mount=type=cache,target=/usr/src/app/.npm \ | ||
npm set cache /usr/src/app/.npm && \ | ||
npm ci | ||
# install | ||
COPY ui /ui | ||
RUN npm run build | ||
|
||
FROM scratch | ||
LABEL org.opencontainers.image.title="Wasm extension" \ | ||
org.opencontainers.image.description="My awesome Wasm extension" \ | ||
org.opencontainers.image.vendor="Docker Inc." \ | ||
com.docker.desktop.extension.api.version="0.3.0" \ | ||
com.docker.extension.screenshots="" \ | ||
com.docker.extension.detailed-description="" \ | ||
com.docker.extension.publisher-url="" \ | ||
com.docker.extension.additional-urls="" \ | ||
com.docker.extension.changelog="" | ||
|
||
COPY --from=wasm-builder /backend/target/wasm32-wasi/release/extension-server.wasm /service.wasm | ||
COPY docker-compose.yaml . | ||
COPY metadata.json . | ||
COPY docker.svg . | ||
COPY --from=client-builder /ui/build ui | ||
EXPOSE 1234 | ||
ENTRYPOINT [ "service.wasm" ] |
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,28 @@ | ||
IMAGE?=crigneydocker/wasm-extension | ||
TAG?=latest | ||
|
||
BUILDER=buildx-multi-arch | ||
|
||
INFO_COLOR = \033[0;36m | ||
NO_COLOR = \033[m | ||
|
||
build-extension: ## Build service image to be deployed as a desktop extension | ||
docker buildx build --platform=wasi/wasm32 --tag=$(IMAGE):$(TAG) . | ||
|
||
install-extension: build-extension ## Install the extension | ||
docker extension install $(IMAGE):$(TAG) | ||
|
||
update-extension: build-extension ## Update the extension | ||
docker extension update $(IMAGE):$(TAG) | ||
|
||
prepare-buildx: ## Create buildx builder for multi-arch build, if not exists | ||
docker buildx inspect $(BUILDER) || docker buildx create --name=$(BUILDER) --driver=docker-container --driver-opt=network=host | ||
|
||
push-extension: prepare-buildx ## Build & Upload extension image to hub. Do not push if tag already exists: make push-extension tag=0.1 | ||
docker pull $(IMAGE):$(TAG) && echo "Failure: Tag already exists" || docker buildx build --push --builder=$(BUILDER) --platform=wasi/wasm32 --build-arg TAG=$(TAG) --tag=$(IMAGE):$(TAG) . | ||
|
||
help: ## Show this help | ||
@echo Please specify a build target. The choices are: | ||
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "$(INFO_COLOR)%-30s$(NO_COLOR) %s\n", $$1, $$2}' | ||
|
||
.PHONY: help |
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,8 @@ | ||
services: | ||
wasm-extension: | ||
image: ${DESKTOP_PLUGIN_IMAGE} | ||
platform: wasi/wasm32 | ||
runtime: io.containerd.wasmedge.v1 | ||
ports: | ||
- 1234:1234 | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,13 @@ | ||
{ | ||
"icon": "docker.svg", | ||
"vm": { | ||
"composefile": "docker-compose.yaml" | ||
}, | ||
"ui": { | ||
"dashboard-tab": { | ||
"title": "My Wasm Extension", | ||
"src": "index.html", | ||
"root": "ui" | ||
} | ||
} | ||
} |
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 @@ | ||
Electron 17.1.1 |
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 @@ | ||
BROWSER=none |
Oops, something went wrong.