Skip to content

Commit 34115dc

Browse files
authored
add configuration to use vuejs sample with Docker Dev Environments feature (#253)
Signed-off-by: Guillaume Lours <[email protected]>
1 parent 6ac068d commit 34115dc

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

vuejs/.docker/docker-compose.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
services:
2+
web:
3+
build:
4+
context: vuejs
5+
target: dev-envs
6+
ports:
7+
- 8080:8080
8+
volumes:
9+
- /var/run/docker.sock:/var/run/docker.sock

vuejs/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@ Stopping vuejs_web_1 ... done
5959
Removing vuejs_web_1 ... done
6060
Removing network vuejs_default
6161
```
62+
63+
## Use with Docker Development Environments
64+
65+
You can use this sample with the Dev Environments feature of Docker Desktop.
66+
To develop directly web service inside containers, you just need to use the https git url of the sample:
67+
`https://github.com/docker/awesome-compose/tree/master/vuejs`
68+
69+
![page](../dev-envs.png)

vuejs/compose.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
services:
22
web:
3-
build: vuejs
3+
build:
4+
context: vuejs
5+
target: development
46
ports:
57
- 8080:8080
68
volumes:

vuejs/vuejs/Dockerfile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM node:14.4.0-alpine
1+
# syntax=docker/dockerfile:1.4
2+
FROM --platform=$BUILDPLATFORM node:14.4.0-alpine AS development
23

34
RUN mkdir /project
45
WORKDIR /project
@@ -9,3 +10,18 @@ RUN yarn global add @vue/cli
910
RUN yarn install
1011
ENV HOST=0.0.0.0
1112
CMD ["yarn", "run", "serve"]
13+
14+
FROM development as dev-envs
15+
RUN <<EOF
16+
apk update
17+
apk add git
18+
EOF
19+
20+
RUN <<EOF
21+
addgroup -S docker
22+
adduser -S --shell /bin/bash --ingroup docker vscode
23+
EOF
24+
# install Docker tools (cli, buildx, compose)
25+
COPY --from=gloursdocker/docker / /
26+
CMD ["yarn", "run", "serve"]
27+

0 commit comments

Comments
 (0)