Skip to content

Commit 2a7f3c1

Browse files
committed
Ok - lets get started then
0 parents  commit 2a7f3c1

19 files changed

+6403
-0
lines changed

.dockerignore

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

.gitignore

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

Dockerfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM --platform=$BUILDPLATFORM node:18.12-alpine3.16 AS client-builder
2+
WORKDIR /ui
3+
# cache packages in layer
4+
COPY ui/package.json /ui/package.json
5+
COPY ui/package-lock.json /ui/package-lock.json
6+
RUN --mount=type=cache,target=/usr/src/app/.npm \
7+
npm set cache /usr/src/app/.npm && \
8+
npm ci
9+
# install
10+
COPY ui /ui
11+
RUN npm run build
12+
13+
FROM alpine
14+
LABEL org.opencontainers.image.title="NGINX Docker Desktop Extension" \
15+
org.opencontainers.image.description="NGINXs Docker Desktop Extension" \
16+
org.opencontainers.image.vendor="NGINX Inc." \
17+
com.docker.desktop.extension.api.version="0.3.3" \
18+
com.docker.extension.screenshots="" \
19+
com.docker.extension.detailed-description="" \
20+
com.docker.extension.publisher-url="" \
21+
com.docker.extension.additional-urls="" \
22+
com.docker.extension.changelog=""
23+
24+
COPY metadata.json .
25+
COPY logo.svg .
26+
COPY --from=client-builder /ui/build ui

Makefile

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
IMAGE?=nginx/nginx-docker-extension
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+
remove-extension:
13+
docker extension remove $(IMAGE):$(TAG)
14+
15+
install-extension: build-extension ## Install the extension
16+
docker extension install $(IMAGE):$(TAG)
17+
18+
update-extension: build-extension ## Update the extension
19+
docker extension update $(IMAGE):$(TAG)
20+
21+
prepare-buildx: ## Create buildx builder for multi-arch build, if not exists
22+
docker buildx inspect $(BUILDER) || docker buildx create --name=$(BUILDER) --driver=docker-container --driver-opt=network=host
23+
24+
push-extension: prepare-buildx ## Build & Upload extension image to hub. Do not push if tag already exists: make push-extension tag=0.1
25+
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) .
26+
27+
help: ## Show this help
28+
@echo Please specify a build target. The choices are:
29+
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "$(INFO_COLOR)%-30s$(NO_COLOR) %s\n", $$1, $$2}'
30+
31+
.PHONY: help

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# NGINX Docker Desktop Extension
2+
3+
4+
## Development
5+
Before we can interactively develop the Extensions frontend, it must be installed first.
6+
7+
To build the extension
8+
```shell
9+
docker build -t nginx/nginx-dd-extension .
10+
```
11+
To install the extension
12+
```shell
13+
docker extension install nginx/nginx-dd-extension
14+
```
15+
16+
To remove the extension
17+
```shell
18+
docker remove nginx/nginx-dd-extension
19+
```
20+
21+
### Start Docker Extension Development Server
22+
1. start the UI node server.
23+
```shell
24+
npm run dev
25+
```
26+
27+
2. enable debugging for the NGINX Docker Extension.
28+
```shell
29+
docker extension dev debug nginx/nginx-dd-extension
30+
```
31+
32+
```shell
33+
docker extension dev ui-source nginx/nginx-dd-extension http://localhost:3000
34+
```

logo.svg

+13
Loading

metadata.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"icon": "logo.svg",
3+
"ui": {
4+
"dashboard-tab": {
5+
"title": "NGINX",
6+
"src": "index.html",
7+
"root": "ui"
8+
}
9+
}
10+
}

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

ui/index.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="color-scheme" content="light dark" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script type="module" src="/src/main.tsx"></script>
11+
</body>
12+
</html>

0 commit comments

Comments
 (0)