File tree 2 files changed +35
-1
lines changed
2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,24 @@ WORKDIR /usr/src/app
7
7
# add `/usr/src/app/node_modules/.bin` to $PATH
8
8
ENV PATH /usr/src/app/node_modules/.bin:$PATH
9
9
10
+ # add environment variables
11
+ ARG REACT_APP_USERS_SERVICE_URL
12
+ ARG NODE_ENV
13
+ ENV NODE_ENV $NODE_ENV
14
+ ENV REACT_APP_USERS_SERVICE_URL $REACT_APP_USERS_SERVICE_URL
15
+
10
16
# install and cache app dependencies
11
17
ADD package.json /usr/src/app/package.json
12
18
RUN npm install --silent
13
19
RUN npm install
[email protected] -g --silent
20
+ RUN npm install pushstate-server -g --silent
14
21
15
22
# add app
16
23
ADD . /usr/src/app
17
24
25
+ # build react app
26
+ RUN npm run build
27
+
18
28
# start app
19
- CMD ["npm " , "start " ]
29
+ CMD ["pushstate-server " , "build " ]
20
30
Original file line number Diff line number Diff line change @@ -37,4 +37,28 @@ $ python manage.py seed_db
37
37
$ python manage.py runserver -p 5555
38
38
```
39
39
40
+ ## Other Command
41
+
42
+ To Build Docker image React App:
43
+ ``` bash
44
+ $ docker build -t " test" ./ --build-arg NODE_ENV=development --build-arg REACT_APP_USERS_SERVICE_URL=http://FLASK_SERVER_URL
45
+ ```
46
+ To run the ` test ` image:
47
+ ``` bash
48
+ $ docker run -d -p 9000:9000 test
49
+ ```
50
+ To view container's environment:
51
+ ``` bash
52
+ $ docker exec CONTAINER_ID bash -c ' env'
53
+ ```
54
+ To stop and remove container:
55
+ ``` bash
56
+ $ docker stop CONTAINER_ID
57
+ $ docker rm CONTAINER_ID
58
+ ```
59
+ To remove the image:
60
+ ``` bash
61
+ $ docker rmi test
62
+ ```
63
+
40
64
You can’t perform that action at this time.
0 commit comments