diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..17b8e04 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +venv/ +__pycache__/ +*.pyc +.git/ +pages/ +static/img/ +static/video/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6f6f3bc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# Use a slim Python image +FROM python:3.11-slim + +# Prevent Python from writing .pyc files and enable unbuffered logging +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 + +# Set work directory +WORKDIR /app + +# Install dependencies +# We do this before copying the whole app to leverage Docker cache +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# Copy the rest of the application code +COPY . . + +# Expose the port your app runs on +EXPOSE 5001 + +CMD ["gunicorn", "--bind", "0.0.0.0:5001", "app:app"] \ No newline at end of file diff --git a/app.py b/app.py index 4d96a82..ea7cb17 100644 --- a/app.py +++ b/app.py @@ -43,4 +43,4 @@ def inject_tags(): return dict(all_cloud_tags=sorted(list(all_tags))) if __name__ == "__main__": - app.run(port=5001, debug=True) \ No newline at end of file + app.run(host='0.0.0.0', port=5001, debug=True) \ No newline at end of file diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..0733dfb --- /dev/null +++ b/compose.yml @@ -0,0 +1,9 @@ +services: + rasmusBendtsenDK: + build: . + ports: + - "5001:5001" + volumes: + - ./pages:/app/pages + - ./static/images:/app/static/images + - ./static/video:/app/static/video diff --git a/requirements.txt b/requirements.txt index 3d8e868..3a39c63 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ flask flask-flatpages +gunicorn \ No newline at end of file