Skip to content

Commit

Permalink
Merge branch 'main-flask' into matomo-implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztof99xd committed Sep 12, 2024
2 parents 79585e2 + 2c91c67 commit a3c8ccd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
35 changes: 18 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
FROM python:3.8-slim as base
# Use an official Python runtime as the parent image
FROM python:3.8-slim

#RUN apt-get update && \
# apt-get install -y libcurl4-openssl-dev && \
# find /var/*/apt -type f -delete
# Set environment variables
# Prevents Python from writing pyc files to disc
ENV PYTHONDONTWRITEBYTECODE 1
# Prevents Python from buffering stdout and stderr
ENV PYTHONUNBUFFERED 1

# Install dependencies
# Create and set the working directory
WORKDIR /app

# Install dependencies
RUN apt-get update && \
apt-get install -y libcurl4-openssl-dev curl && \
apt-get install -y git && \
Expand All @@ -14,7 +20,6 @@ RUN apt-get update && \
node -v && \
find /var/*/apt -type f -delete


RUN pip install --no-cache-dir Flask-SQLAlchemy \
SQLAlchemy \
beautifulsoup4 \
Expand All @@ -28,18 +33,14 @@ RUN pip install --no-cache-dir Flask-SQLAlchemy \

RUN npm install -g sass

FROM base AS final

WORKDIR /app

COPY . /app
# Copy the current directory contents into the container at /app
COPY . /app/

# Create database
RUN python3 content_to_db.py

# ENV FLASK_APP=app.py
# ENV FLASK_RUN_HOST=0.0.0.0

# EXPOSE 5000

# Make port 80 available to the world outside this container
EXPOSE 8080

# CMD ["python3", "-m" , "flask", "run", "--host=0.0.0.0"]
# Run gunicorn when the container launches
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--workers", "4", "app:app"]
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,4 @@ def sitemap():

# Run App
if __name__ == '__main__':
app.run(debug=True)
app.run(debug=os.environ.get('DEBUG', False), host='0.0.0.0', port=8080)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ latex_table = df_models.to_latex(
caption="Comparison of ML Model Performance Metrics", # The caption to appear above the table in the LaTeX document
label="tab:model_comparison", # A label used for referencing the table within the LaTeX document
position="htbp", # The preferred positions where the table should be placed in the document ('here', 'top', 'bottom', 'page')
column_format="|l|l|l|l|", # The format of the columns: left-aligned with vertical lines between them
column_format="lccc", # The format of the columns: left-aligend first column and center-aligned remaining columns as per APA guidelines
escape=False, # Disable escaping LaTeX special characters in the DataFrame
float_format="{:0.2f}".format # Formats floats to two decimal places
)
Expand Down

0 comments on commit a3c8ccd

Please sign in to comment.