Skip to content

Commit

Permalink
Add simple flask app
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMillar-MOJ committed May 16, 2024
1 parent 11413aa commit b59dad1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM python:3.12-slim

ENV FLASK_RUN_HOST=0.0.0.0
ENV FLASK_RUN_PORT=8000

# Set the working directory in the container
WORKDIR /usr/src/app

Expand All @@ -9,14 +12,20 @@ RUN adduser --disabled-password --gecos '' containeruser
# Change ownership of the working directory to the non-root user
RUN chown -R containeruser:containeruser /usr/src/app

# Copy the dependencies file to the working directory
COPY requirements.in ./

# Install any needed dependencies
RUN pip install --no-cache-dir -r requirements.in

# Copy the project code into the working directory
COPY . .

# Switch to the non-root user
USER containeruser

# Expose the Flask port
EXPOSE 8000

# Run the Flask application for development
CMD ["flask", "run", "--cert=adhoc"]
CMD ["flask", "run"]
8 changes: 8 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from flask import Flask

app = Flask(__name__)


@app.route("/")
def hello_world():
return "<p>Hello, World!</p>"

0 comments on commit b59dad1

Please sign in to comment.