-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7ec9f53
Showing
7 changed files
with
93 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# ignore files with below extensions | ||
*.pyc | ||
*.pyo | ||
*.log | ||
*.sqlite3 | ||
|
||
# ignore below files | ||
.coverage | ||
yarn.lock | ||
package-lock.json | ||
.env.secrets | ||
.ash_history | ||
.bash_history | ||
|
||
# ignore below directories | ||
__pycache__/ | ||
node_modules/ | ||
.cache/ | ||
.pytest_cache/ |
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,9 @@ | ||
# Description | ||
|
||
Plain flask init project. | ||
|
||
# Instructions | ||
|
||
```bash | ||
$ docker-compose up | ||
``` |
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,8 @@ | ||
from flask import Flask | ||
|
||
|
||
app = Flask(__name__) | ||
|
||
@app.route('/') | ||
def hello_world(): | ||
return 'Hello, World!' |
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 @@ | ||
Flask |
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,14 @@ | ||
#!/bin/ash | ||
|
||
echo "Install requirements.txt" | ||
pip install -r /app/requirements.txt --no-cache-dir | ||
|
||
# is $@ empty | ||
if [ -z "$@" ] | ||
then | ||
echo "Run App" | ||
flask run --host=0.0.0.0 --port=$PORT | ||
else | ||
echo "Executeing \$@ command: $@" | ||
exec $@ | ||
fi |
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,12 @@ | ||
version: "3.8" | ||
services: | ||
app: | ||
build: | ||
context: ./app | ||
dockerfile: ../docker/Dockerfile | ||
image: flask/demo | ||
container_name: flask-demo | ||
hostname: flask-dev-demo | ||
volumes: | ||
- ./app:/app | ||
# command: sleep 3600 |
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,30 @@ | ||
FROM python:3.7.9-alpine | ||
|
||
ARG PORT=8000 | ||
ENV PORT=$PORT | ||
ARG FLASK_APP=/app/hello.py | ||
ENV FLASK_APP=$FLASK_APP | ||
|
||
ENV HOME=/app | ||
ENV PYTHONUNBUFFERED=True | ||
ENV PYTHONIOENCODING=UTF-8 | ||
|
||
WORKDIR /app | ||
COPY . /app | ||
|
||
# Fixed permissions, create exec:exec and dev:dev | ||
RUN sed -i '/999/d;' /etc/group | ||
RUN addgroup -S -g 999 exec && adduser -u 999 -s /sbin/nologin -SDHG exec exec | ||
RUN adduser -DH dev && adduser exec dev | ||
RUN chown -R exec:dev \ | ||
/app \ | ||
/usr/local/bin/ \ | ||
/usr/local/lib/python3.7/ | ||
RUN chmod -R a-w /etc | ||
|
||
VOLUME /app | ||
EXPOSE ${PORT} | ||
|
||
USER exec:dev | ||
|
||
ENTRYPOINT ["/app/scripts/startup.sh"] |