Skip to content

Commit 0efbb21

Browse files
committed
initialize fetchit extension
Signed-off-by: Oleg <[email protected]>
0 parents  commit 0efbb21

18 files changed

+33253
-0
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ui/node_modules

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
ui/build

Dockerfile

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM golang:1.19-alpine AS builder
2+
ENV CGO_ENABLED=0
3+
WORKDIR /backend
4+
COPY vm/go.* ./
5+
RUN --mount=type=cache,target=/go/pkg/mod \
6+
--mount=type=cache,target=/root/.cache/go-build \
7+
go mod download
8+
COPY vm/. .
9+
RUN --mount=type=cache,target=/go/pkg/mod \
10+
--mount=type=cache,target=/root/.cache/go-build \
11+
go build -trimpath -ldflags="-s -w" -o bin/service
12+
13+
FROM --platform=$BUILDPLATFORM node:18.9-alpine3.15 AS client-builder
14+
WORKDIR /ui
15+
# cache packages in layer
16+
COPY ui/package.json /ui/package.json
17+
COPY ui/package-lock.json /ui/package-lock.json
18+
RUN --mount=type=cache,target=/usr/src/app/.npm \
19+
npm set cache /usr/src/app/.npm && \
20+
npm ci
21+
# install
22+
COPY ui /ui
23+
RUN npm run build
24+
25+
FROM alpine
26+
LABEL org.opencontainers.image.title="Fetchit" \
27+
org.opencontainers.image.description=" FetchIt is used to manage the life cycle and configuration of Podman containers" \
28+
org.opencontainers.image.vendor="Red Hat Inc." \
29+
com.docker.desktop.extension.api.version="0.3.0" \
30+
com.docker.extension.screenshots="" \
31+
com.docker.extension.detailed-description="" \
32+
com.docker.extension.publisher-url="" \
33+
com.docker.extension.additional-urls="" \
34+
com.docker.extension.changelog=""
35+
36+
COPY --from=builder /backend/bin/service /
37+
COPY docker-compose.yaml .
38+
COPY metadata.json .
39+
COPY docker.svg .
40+
COPY --from=client-builder /ui/build ui
41+
CMD /service -socket /run/guest-services/extension-fetchit.sock

Makefile

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
IMAGE?=robotsail/fetchit-podman-desktop
2+
TAG?=latest
3+
4+
BUILDER=buildx-multi-arch
5+
6+
INFO_COLOR = \033[0;36m
7+
NO_COLOR = \033[m
8+
9+
build-extension: ## Build service image to be deployed as a desktop extension
10+
docker build --tag=$(IMAGE):$(TAG) .
11+
12+
install-extension: build-extension ## Install the extension
13+
docker extension install $(IMAGE):$(TAG)
14+
15+
update-extension: build-extension ## Update the extension
16+
docker extension update $(IMAGE):$(TAG)
17+
18+
prepare-buildx: ## Create buildx builder for multi-arch build, if not exists
19+
docker buildx inspect $(BUILDER) || docker buildx create --name=$(BUILDER) --driver=docker-container --driver-opt=network=host
20+
21+
push-extension: prepare-buildx ## Build & Upload extension image to hub. Do not push if tag already exists: make push-extension tag=0.1
22+
docker pull $(IMAGE):$(TAG) && echo "Failure: Tag already exists" || docker buildx build --push --builder=$(BUILDER) --platform=linux/amd64,linux/arm64 --build-arg TAG=$(TAG) --tag=$(IMAGE):$(TAG) .
23+
24+
help: ## Show this help
25+
@echo Please specify a build target. The choices are:
26+
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "$(INFO_COLOR)%-30s$(NO_COLOR) %s\n", $$1, $$2}'
27+
28+
.PHONY: help

docker-compose.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
services:
2+
fetchit:
3+
image: ${DESKTOP_PLUGIN_IMAGE}

docker.svg

+22
Loading

metadata.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"icon": "docker.svg",
3+
"vm": {
4+
"composefile": "docker-compose.yaml",
5+
"exposes": {
6+
"socket": "extension-fetchit.sock"
7+
}
8+
},
9+
"ui": {
10+
"dashboard-tab": {
11+
"title": "Fetchit",
12+
"src": "index.html",
13+
"root": "ui",
14+
"backend": {
15+
"socket": "extension-fetchit.sock"
16+
}
17+
}
18+
}
19+
}

ui/.browserslistrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Electron 17.1.1

ui/.env

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BROWSER=none

0 commit comments

Comments
 (0)