Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #20 from felipecruz91/feature/improve-performance
Browse files Browse the repository at this point in the history
Use backend service to get volumes, containers and sizes
  • Loading branch information
felipecruz91 authored Jul 16, 2022
2 parents 8e82ab2 + ef61502 commit cdb660b
Show file tree
Hide file tree
Showing 13 changed files with 778 additions and 454 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/hadolint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
- uses: hadolint/hadolint-action@v2.0.0
with:
dockerfile: Dockerfile
ignore: DL3048
ignore: DL3048,DL3025
18 changes: 17 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
FROM golang:1.17-alpine AS builder
ENV CGO_ENABLED=0
WORKDIR /backend
COPY vm/go.* .
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go mod download
COPY vm/. .
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go build -trimpath -ldflags="-s -w" -o bin/service

FROM --platform=$BUILDPLATFORM node:17.7-alpine3.14 AS client-builder
WORKDIR /ui
# cache packages in layer
Expand All @@ -10,7 +22,7 @@ RUN --mount=type=cache,target=/usr/src/app/.npm \
COPY ui /ui
RUN npm run build

FROM alpine:3.16
FROM busybox:1.35.0
LABEL org.opencontainers.image.title="vackup-docker-extension" \
org.opencontainers.image.description="Easily backup and restore docker volumes." \
org.opencontainers.image.vendor="Felipe" \
Expand All @@ -22,8 +34,12 @@ LABEL org.opencontainers.image.title="vackup-docker-extension" \
com.docker.extension.changelog=""

WORKDIR /
COPY docker-compose.yaml .
COPY metadata.json .
COPY docker.svg .
COPY --from=builder /backend/bin/service /
COPY --from=client-builder /ui/build ui

RUN mkdir -p /vackup

CMD /service -socket /run/guest-services/extension-vackup.sock
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ install-extension: build-extension ## Install the extension
update-extension: build-extension ## Update the extension
docker extension update $(IMAGE):$(TAG) -f

dev-up:
docker extension dev ui-source $(IMAGE):$(TAG) http://localhost:3000
docker extension dev debug $(IMAGE):$(TAG)

dev-reset:
docker extension dev reset $(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

Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
vackup-docker-extension:
image: ${DESKTOP_PLUGIN_IMAGE}
restart: unless-stopped
volumes:
- /var/run/docker.sock.raw:/var/run/docker.sock
11 changes: 10 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
{
"icon": "docker.svg",
"vm": {
"composefile": "docker-compose.yaml",
"exposes": {
"socket": "extension-vackup.sock"
}
},
"ui": {
"dashboard-tab": {
"title": "Vackup",
"src": "index.html",
"root": "ui"
"root": "ui",
"backend": {
"socket": "extension-vackup.sock"
}
}
}
}
14 changes: 7 additions & 7 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@docker/docker-mui-theme": "^0.0.6",
"@docker/docker-mui-theme": "^0.0.7",
"@docker/extension-api-client": "^0.2.3",
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
Expand Down
Loading

0 comments on commit cdb660b

Please sign in to comment.