https://github.com/euiyounghwang/es_docker
initiial ES_Docker
https://github.com/euiyounghwang/es_docker
Last synced: 7 months ago
JSON representation
initiial ES_Docker
- Host: GitHub
- URL: https://github.com/euiyounghwang/es_docker
- Owner: euiyounghwang
- Created: 2022-07-04T18:19:32.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-09-12T18:22:53.000Z (about 2 years ago)
- Last Synced: 2025-01-17T19:55:24.793Z (9 months ago)
- Language: Python
- Size: 213 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ES_Docker
# Create a Running Docker Container With Gunicorn and Flask
**Create Flask**
```
from flask import Flask
app = Flask(__name__)@app.route('/')
@app.route('/index')
def index():
return 'Hello world!'```
**Next, let’s write the command that will run the Gunicorn server:**
```
#!/bin/sh
gunicorn --chdir path main:app -w 2 --threads 2 -b 0.0.0.0:8000
```The parameters are pretty much self-explanatory: We are telling Gunicorn that we want to spawn two worker processes running two threads each. We are also accepting connections from the outside and overriding Gunicorn’s default port (8000).
**Our basic Dockerfile:**
```
FROM python:3.7.3-slim
COPY requirements.txt /
RUN pip3 install -r /requirements.txt
COPY . /app
WORKDIR /app
ENTRYPOINT ["./gunicorn_starter.sh"]
```**Let’s build our image:**
```
docker build -t flask/hello-world .
```
**And run:**
```
docker run -p 8003:8003 flask/hello-world
docker run --name flask_web_api -e PYTHONUNBUFFERED=1 -p 8004:8004 flaskrest/swagger```
**And Test:**
$ curl localhost:8003
Hello world!**Git Interface:**
```sh
echo "# a" >> README.md
git init
git config --global user.name "euiyoung.hwang"
git config --global user.email marieuig@gmail.com
git status
git add README.md (OR git add .)
git commit -m "first commit"
git branch -M master
git remote add origin https://github.com/euiyounghwang/a.git
git push -u origin master
```