Skip to content

Commit

Permalink
(web):baby flask: undo changes
Browse files Browse the repository at this point in the history
saintbarber committed Jul 3, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 2eb5e9a commit 467c6af
Showing 6 changed files with 29 additions and 8 deletions.
7 changes: 4 additions & 3 deletions web/baby-flask/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# version: '3'
version: '3'
services:
web:
build:
context: ./setup
dockerfile: Dockerfile
image: ghcr.io/cybermouflons/gtbq-2024/baby-flask:latest
ports:
- 5000:5000
- 1337:80
environment:
- FLASK_APP=/app/app.py
- FLASK_ENV=development
volumes:
- ./setup/app/:/app
- /etc/machine-id:/etc/machine-id
# - ./setup/app:/app
5 changes: 5 additions & 0 deletions web/baby-flask/setup/Dockerfile
Original file line number Diff line number Diff line change
@@ -15,6 +15,11 @@ RUN pip install --no-cache-dir -r requirements.txt

COPY ./app /app/

EXPOSE 80

RUN rm /etc/nginx/sites-enabled/default
COPY conf/app.conf /etc/nginx/sites-enabled/app

COPY supervisor.conf /etc/supervisor/conf.d/supervisor.conf

ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisor.conf"]
3 changes: 1 addition & 2 deletions web/baby-flask/setup/app/app.py
Original file line number Diff line number Diff line change
@@ -23,5 +23,4 @@ def get_file():

if __name__ == '__main__':
# I enabled debug mode so I can debug using /console
app.run('0.0.0.0', 5000, debug=True)

app.run('127.0.0.1', 5000, debug=True)
5 changes: 2 additions & 3 deletions web/baby-flask/setup/app/templates/index.html
Original file line number Diff line number Diff line change
@@ -13,11 +13,10 @@ <h4 class="text-neon">Click on a file to view it!</h4>
<ul class="list-group">
{% for file in files %}
<li class="list-group-item bg-dark border-light">
<a href="/get_file?filename=/app/files/{{file}}">{{file}}</a>
<!-- <form action="/get_file" method="post" class="d-inline">
<form action="/get_file" method="post" class="d-inline">
<input type="hidden" name="filename" value="/app/files/{{ file }}">
<button type="submit" class="btn btn-link text-neon">{{ file }}</button>
</form> -->
</form>
</li>
{% endfor %}
</ul>
13 changes: 13 additions & 0 deletions web/baby-flask/setup/conf/app.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
server {

listen 80;

location / {
proxy_pass http://127.0.0.1:5000;
proxy_pass_header Server;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host 127.0.0.1;
proxy_redirect off;
}

}
4 changes: 4 additions & 0 deletions web/baby-flask/setup/supervisor.conf
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@
user=root
nodaemon=true

[program:nginx]
user=root
command=/usr/sbin/nginx -g "daemon off;"

[program:flask]
user=root
command=python /app/app.py

0 comments on commit 467c6af

Please sign in to comment.