Skip to content

Commit 3666e39

Browse files
committed
Update project to use Compose for dev setup
1 parent 7e48e1e commit 3666e39

File tree

4 files changed

+40
-14
lines changed

4 files changed

+40
-14
lines changed

Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
FROM node:lts-slim AS build
1+
FROM node:lts-slim AS base
22
WORKDIR /usr/local/app
33
COPY package*.json ./
44
RUN npm install
55
COPY --link eslint.config.js vite.config.js index.html ./
66
COPY --link ./public ./public
77
COPY --link ./src ./src
8+
9+
FROM base AS dev
10+
CMD ["npm", "run", "dev"]
11+
12+
FROM base AS build
813
RUN npm run build && ls dist
914

1015
FROM alpine

README.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,31 @@ This repo contains the code for the Docker Desktop extension for Labspaces.
66

77
To develop the extension, run the following steps:
88

9-
1. Install the NPM dependencies:
9+
1. Start the app with Compose Watch:
1010

1111
```console
12-
npm install
12+
docker compose up --watch
1313
```
1414

15-
2. Start the app:
16-
17-
```console
18-
npm run dev
19-
```
20-
21-
3. If you don't have the extension installed yet, install it:
15+
2. If you don't have the extension installed yet, install it:
2216

2317
```console
2418
docker extension install dockersamples/labspace-extension
2519
```
2620

27-
4. Enable debug mode for the extension (to get the Chrome developer tools):
21+
3. Enable debug mode for the extension (to get the Chrome developer tools):
2822

2923
```console
3024
docker extension dev debug dockersamples/labspace-extension
3125
```
3226

33-
5. Set the UI source for the extension to be your development environment:
27+
4. Set the UI source for the extension to be your development environment:
3428

3529
```console
3630
docker extension dev ui-source dockersamples/labspace-extension http://localhost:5173
3731
```
3832

39-
6. Open the extension in Docker Desktop. It will now be using the Vite reload server for the UI, allowing you to make changes and see them reflected immediately.
33+
5. Open the extension in Docker Desktop. It will now be using the Vite reload server for the UI, allowing you to make changes and see them reflected immediately.
4034

4135
## Deep link support
4236

compose.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
services:
2+
app:
3+
build:
4+
context: ./
5+
target: dev
6+
ports:
7+
- 5173:5173
8+
develop:
9+
watch:
10+
- path: ./
11+
action: sync
12+
target: /usr/local/app
13+
initial_sync: true
14+
ignore:
15+
- dev/**
16+
- compose.yaml
17+
- Dockerfile
18+
- node_modules
19+
- path: ./package-lock.json
20+
action: rebuild
21+
22+
assets:
23+
build: ./dev
24+
ports:
25+
- 80:80
26+
volumes:
27+
- ./dev/src:/usr/share/nginx/html

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "0.0.0",
55
"type": "module",
66
"scripts": {
7-
"dev": "vite",
7+
"dev": "vite --host 0.0.0.0",
88
"build": "vite build",
99
"lint": "eslint .",
1010
"preview": "vite preview",

0 commit comments

Comments
 (0)