added auto-generated stuff from vs code, not sure if it works yet but it looks good.
This commit is contained in:
parent
f30215ffe9
commit
d69ae01232
26
.dockerignore
Normal file
26
.dockerignore
Normal file
@ -0,0 +1,26 @@
|
||||
**/__pycache__
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/azds.yaml
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
README.md
|
||||
19
.vscode/launch.json
vendored
Normal file
19
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Docker: Python - Flask",
|
||||
"type": "docker",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "docker-run: debug",
|
||||
"python": {
|
||||
"pathMappings": [
|
||||
{
|
||||
"localRoot": "${workspaceFolder}",
|
||||
"remoteRoot": "/app"
|
||||
}
|
||||
],
|
||||
"projectType": "flask"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
40
.vscode/tasks.json
vendored
Normal file
40
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "docker-build",
|
||||
"label": "docker-build",
|
||||
"platform": "python",
|
||||
"dockerBuild": {
|
||||
"tag": "simpleblogapi:latest",
|
||||
"dockerfile": "${workspaceFolder}/Dockerfile",
|
||||
"context": "${workspaceFolder}",
|
||||
"pull": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "docker-run",
|
||||
"label": "docker-run: debug",
|
||||
"dependsOn": [
|
||||
"docker-build"
|
||||
],
|
||||
"dockerRun": {
|
||||
"env": {
|
||||
"FLASK_APP": "wsgi.py"
|
||||
}
|
||||
},
|
||||
"python": {
|
||||
"args": [
|
||||
"run",
|
||||
"--no-debugger",
|
||||
"--no-reload",
|
||||
"--host",
|
||||
"0.0.0.0",
|
||||
"--port",
|
||||
"5000"
|
||||
],
|
||||
"module": "flask"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
23
Dockerfile
23
Dockerfile
@ -1,17 +1,26 @@
|
||||
FROM python:3.8
|
||||
# For more information, please refer to https://aka.ms/vscode-docker-python
|
||||
FROM python:3.8-slim-buster
|
||||
|
||||
RUN pip3 install pipenv gunicorn
|
||||
EXPOSE 5000
|
||||
|
||||
ENV PROJECT_DIR /usr/src/simpleblogapi
|
||||
# Keeps Python from generating .pyc files in the container
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
WORKDIR ${PROJECT_DIR}
|
||||
# Turns off buffering for easier container logging
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# Install pip requirements
|
||||
COPY Pipfile .
|
||||
COPY Pipfile.lock .
|
||||
COPY . .
|
||||
|
||||
RUN pipenv install --deploy --ignore-pipfile
|
||||
|
||||
EXPOSE 5400
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
|
||||
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
|
||||
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
|
||||
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
|
||||
USER appuser
|
||||
|
||||
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
|
||||
CMD ["gunicorn", "-c", "gunicorn_config.py", "wsgi:api"]
|
||||
|
||||
14
docker-compose.debug.yml
Normal file
14
docker-compose.debug.yml
Normal file
@ -0,0 +1,14 @@
|
||||
version: '3.4'
|
||||
|
||||
services:
|
||||
simpleblogapi:
|
||||
image: simpleblogapi
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./Dockerfile
|
||||
command: ["sh", "-c", "pip install debugpy -t /tmp && python /tmp/debugpy --wait-for-client --listen 0.0.0.0:5678 -m flask run --no-debugger --no-reload --host 0.0.0.0 --port 5000"]
|
||||
ports:
|
||||
- 5000:5000
|
||||
- 5678:5678
|
||||
environment:
|
||||
- FLASK_APP=wsgi.py
|
||||
10
docker-compose.yml
Normal file
10
docker-compose.yml
Normal file
@ -0,0 +1,10 @@
|
||||
version: '3.4'
|
||||
|
||||
services:
|
||||
simpleblogapi:
|
||||
image: simpleblogapi
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./Dockerfile
|
||||
ports:
|
||||
- 5000:5000
|
||||
@ -1,4 +1,4 @@
|
||||
# to run: gunicorn -c gunicorn_config.py wsgi:api
|
||||
|
||||
bind = "0.0.0.0:5400"
|
||||
bind = "0.0.0.0:5000"
|
||||
workers = 2
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
# To ensure app dependencies are ported from your virtual environment/host machine into your container, run 'pip freeze > requirements.txt' in the terminal to overwrite this file
|
||||
flask==1.1.2
|
||||
gunicorn==20.0.4
|
||||
aniso8601==9.0.1
|
||||
beautifulsoup4==4.9.3
|
||||
click==8.0.1
|
||||
Flask==2.0.1
|
||||
Flask-RESTful==0.3.9
|
||||
gunicorn==20.1.0
|
||||
itsdangerous==2.0.1
|
||||
Jinja2==3.0.1
|
||||
Markdown==3.3.4
|
||||
@ -11,4 +12,3 @@ MarkupSafe==2.0.1
|
||||
pytz==2021.1
|
||||
six==1.16.0
|
||||
soupsieve==2.2.1
|
||||
Werkzeug==2.0.1
|
||||
|
||||
Reference in New Issue
Block a user