Skip to content

Commit

Permalink
dockerize react app and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
akmamun committed Oct 27, 2019
1 parent 42aa2b2 commit eedf578
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [Datetime (Unix , RealTime and Formatted Datetime)](js/datetime.js)
## React JS
- [React ENV Create](react-js/env.md)
- [Dockerize React App](docker/react/Dockerfile)
- [React Socket Connection](react-js/Socket.js)
- [Exportable API Endpoint](react-js/api/ApiHelper.js)
- [Example API Helper Routes ](react-js/api/ExampleApi.js)
Expand Down Expand Up @@ -35,7 +36,7 @@
## Python
- [Flask Socket Connection](python/flask_socket.py)
- [Flask Socket Connection with Pubsub to listen subscription messages](python/flask_pubsub.py)
- [Dockerize Flask App](python/Dockerfile)
- [Dockerize Flask App](docker/python/Dockerfile)
- [Python Open-CV Video Recording](python/video_record.py)
- [Find Router Connected Device Ip List](python/router_ip_address.py)
- [Google Cloud Pub/Sub Publishing/subscription messages and subscriptions list](python/pubsub.py)
Expand All @@ -62,7 +63,7 @@
- [Set Go Path](go/go-path-set.go)

## System
- [Supervisor Installation and Procedure](system/supervisor/frontend.MD)
- [Supervisor Installation and Procedure](system/supervisor/README.MD)

## Other
- [Install Protobuf 3 on Ubuntu](https://gist.github.com/mrxmamun/c3afc8e9318135d5f79177ff528655a4)
Expand Down
46 changes: 46 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## Installation
- Install [Docker](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04)
- Make a file name Dockerfile ```touch Dockerfile```

### Flask App [Dockerfile](/docker/python/Dockerfile)
```sh
FROM python:3.8-alpine

RUN apk add --no-cache python3-dev \
&& pip3 install --upgrade pip

WORKDIR /src

COPY . .

RUN pip install -r requirements.txt

EXPOSE 5000

ENTRYPOINT ["python3"]

CMD ["app.py"]
```
### React App [Dockerfile](/docker/python/Dockerfile)
```sh
# base image
FROM node:12.13.0-alpine

# set working directory
WORKDIR /src

# add `/app/node_modules/.bin` to $PATH
ENV PATH /src/node_modules/.bin:$PATH

# install and cache app dependencies
COPY . .
RUN npm install --silent
RUN npm install [email protected] -g --silent

# start app
CMD ["npm", "start"]
```
### Instruction
- `docker build -t name .`
- `docker run --name name -d -p port:port name` or
- `docker run --name name -d -p port:port --network host name`
2 changes: 1 addition & 1 deletion python/Dockerfile → docker/python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-alpine
FROM python:3.8-alpine

RUN apk add --no-cache python3-dev \
&& pip3 install --upgrade pip
Expand Down
16 changes: 16 additions & 0 deletions docker/react/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# base image
FROM node:12.13.0-alpine

# set working directory
WORKDIR /src

# add `/app/node_modules/.bin` to $PATH
ENV PATH /src/node_modules/.bin:$PATH

# install and cache app dependencies
COPY . .
RUN npm install --silent
RUN npm install [email protected] -g --silent

# start app
CMD ["npm", "start"]
File renamed without changes.

0 comments on commit eedf578

Please sign in to comment.