File tree Expand file tree Collapse file tree 4 files changed +40
-1
lines changed Expand file tree Collapse file tree 4 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 1+ services :
2+ frontend :
3+ build :
4+ context : .
5+ target : dev-envs
6+ container_name : frontend
7+ ports :
8+ - " 80:3000"
9+ - " 3000:3000"
10+ volumes :
11+ - /var/run/docker.sock:/var/run/docker.sock
Original file line number Diff line number Diff line change 1+ # syntax=docker/dockerfile:1.4
2+
13# 1. For build React app
24FROM node:lts AS development
35
@@ -22,6 +24,22 @@ FROM development AS build
2224
2325RUN npm run build
2426
27+
28+ FROM development as dev-envs
29+ RUN <<EOF
30+ apt-get update
31+ apt-get install -y --no-install-recommends git
32+ EOF
33+
34+ RUN <<EOF
35+ useradd -s /bin/bash -m vscode
36+ groupadd docker
37+ usermod -aG docker vscode
38+ EOF
39+ # install Docker tools (cli, buildx, compose)
40+ COPY --from=gloursdocker/docker / /
41+ CMD [ "npm" , "start" ]
42+
2543# 2. For Nginx setup
2644FROM nginx:alpine
2745
Original file line number Diff line number Diff line change @@ -86,3 +86,14 @@ Stopping frontend ... done
8686Removing frontend ... done
8787Removing network react-nginx_default
8888```
89+
90+ ## Use with Docker Development Environments
91+
92+ You can use this sample with the Dev Environments feature of Docker Desktop.
93+
94+ ![ Screenshot of creating a Dev Environment in Docker Desktop] ( ../dev-envs.png )
95+
96+ To develop directly on the services inside containers, use the HTTPS Git url of the sample:
97+ ```
98+ https://github.com/docker/awesome-compose/tree/master/react-nginx
99+ ```
Original file line number Diff line number Diff line change 1- version : " 3.7"
21services :
32 frontend :
43 build :
You can’t perform that action at this time.
0 commit comments