Skip to content

Instantly share code, notes, and snippets.

@nbcchen
Last active August 12, 2024 16:13
Show Gist options
  • Save nbcchen/1891a4602dd03579d4a629a3da0e3476 to your computer and use it in GitHub Desktop.
Save nbcchen/1891a4602dd03579d4a629a3da0e3476 to your computer and use it in GitHub Desktop.
Flask
from flask import Flask, render_template
import os
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
if __name__ == "__main__":
port = int(os.environ.get('PORT', 5000))
app.run(debug=True, host='0.0.0.0', port=port)
FROM python:3.8-alpine
COPY ./requirements.txt /app/requirements.txt
WORKDIR /app
RUN pip install -r requirements.txt
# copy every content from the local file to the image
COPY . /app
# configure the container to run in an executed manner
ENTRYPOINT [ "python" ]
CMD ["app.py"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment