Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
langdal committed Jan 21, 2021
0 parents commit 6ed22c1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
env
28 changes: 28 additions & 0 deletions Dockerfile
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" ]
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Flask==1.1.2
11 changes: 11 additions & 0 deletions src/server.py
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')

0 comments on commit 6ed22c1

Please sign in to comment.