-
Notifications
You must be signed in to change notification settings - Fork 1
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 6ed22c1
Showing
4 changed files
with
41 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 @@ | ||
env |
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,28 @@ | ||
# First stage | ||
FROM python:3.9.1 AS builder | ||
|
||
ENV VIRTUAL_ENV=/opt/venv | ||
RUN python3 -m venv ${VIRTUAL_ENV} | ||
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" | ||
|
||
RUN pip install --upgrade pip && pip install pip-tools | ||
|
||
COPY requirements.txt . | ||
RUN pip install -r requirements.txt | ||
|
||
# Second stage | ||
FROM python:3.9.1-slim | ||
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV} | ||
WORKDIR /code | ||
|
||
# add non-root user | ||
RUN addgroup --system user && adduser --system --no-create-home --group user | ||
RUN chown -R user:user /code && chmod -R 755 /code | ||
|
||
USER user | ||
|
||
COPY src/ /code | ||
|
||
ENV PATH=/opt/venv/bin:${PATH} | ||
|
||
CMD [ "python", "./server.py" ] |
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==1.1.2 |
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,11 @@ | ||
from flask import Flask | ||
server = Flask(__name__) | ||
|
||
|
||
@server.route("/") | ||
def hello(): | ||
return "Hello World!" | ||
|
||
|
||
if __name__ == "__main__": | ||
server.run(host='0.0.0.0') |