Skip to content

Instantly share code, notes, and snippets.

@cellularmitosis cellularmitosis/Dockerfile
Last active Oct 15, 2019

Embed
What would you like to do?
A Dockerized Flask "Hello, World!"

Blog 2019/8/16

<- previous | index | next ->

A Dockerized Flask "Hello, World!"

cobbled together from a few tutorials online.

Just run make.

FROM python:3-alpine
WORKDIR /opt/hello-flask
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "./hello-flask.py"]
#!/usr/bin/env python
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_flask():
return "Hello, Flask!"
if __name__ == '__main__':
# enable debug mode by setting the env var FLASK_ENV=development
app.run(host='0.0.0.0', port=80)
run: build
docker run -it --rm -p 5000:80 -e FLASK_ENV='development' hello-flask
build:
docker build -t hello-flask .
Flask==1.1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.