-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dockerize react app and update readme
- Loading branch information
Showing
5 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.