-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from diverso-lab/develop
Develop
- Loading branch information
Showing
81 changed files
with
1,605 additions
and
310 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,10 @@ | ||
FLASK_APP_NAME=UVLHUB.IO (dev) | ||
FLASK_ENV=development | ||
DOMAIN=localhost | ||
MARIADB_HOSTNAME=db | ||
MARIADB_PORT=3306 | ||
MARIADB_DATABASE=uvlhubdb | ||
MARIADB_TEST_DATABASE=uvlhubdb_test | ||
MARIADB_USER=uvlhubdb_user | ||
MARIADB_PASSWORD=uvlhubdb_password | ||
MARIADB_ROOT_PASSWORD=uvlhubdb_root_password |
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
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
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 |
---|---|---|
@@ -1,29 +1,46 @@ | ||
# Use an official Python runtime as a parent image | ||
FROM python:3.11-alpine | ||
FROM python:3.12-alpine | ||
|
||
# Install the MySQL client to be able to use it in the standby script. | ||
RUN apk add --no-cache mysql-client | ||
# Set this environment variable to suppress the "Running as root" warning from pip | ||
ENV PIP_ROOT_USER_ACTION=ignore | ||
|
||
# Install the MariaDB client to be able to use it in the standby script. | ||
RUN apk add --no-cache mariadb-client \ | ||
&& apk add --no-cache --virtual .build-deps gcc musl-dev python3-dev libffi-dev | ||
|
||
# Set the working directory in the container to /app | ||
WORKDIR /app | ||
|
||
# Copy the contents of the local app/ directory to the /app directory in the container | ||
COPY app/ ./app | ||
|
||
# Copy requirements.txt at the /app working directory | ||
COPY requirements.txt . | ||
|
||
# Copy the wait-for-db.sh script and set execution permissions | ||
COPY --chmod=+x scripts/wait-for-db.sh ./scripts/ | ||
|
||
# Install any needed packages specified in requirements.txt | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
# Copy the init-db.sh script and set execution permissions | ||
COPY --chmod=+x scripts/init-db.sh ./scripts/ | ||
|
||
# Copy files | ||
COPY rosemary/ ./rosemary | ||
COPY setup.py ./ | ||
|
||
# Copy the entrypoint script | ||
COPY scripts/entrypoint.sh /usr/local/bin/entrypoint.sh | ||
|
||
# Update pip | ||
RUN pip install --no-cache-dir --upgrade pip | ||
|
||
# Install any needed packages specified in requirements.txt | ||
RUN pip install -r requirements.txt | ||
|
||
# Make the entrypoint script executable | ||
RUN chmod +x /usr/local/bin/entrypoint.sh | ||
|
||
# Expose port 5000 | ||
EXPOSE 5000 | ||
|
||
# Sets the CMD command to correctly execute the wait-for-db.sh script | ||
CMD sh ./scripts/wait-for-db.sh && flask db upgrade && flask run --host=0.0.0.0 --port=5000 --reload --debug | ||
# Set the entrypoint to run the entrypoint script | ||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | ||
|
||
# Sets the default command to start the Flask application | ||
CMD sh /app/scripts/wait-for-db.sh && sh /app/scripts/init-db.sh && rosemary db:migrate && rosemary db:seed -y --reset && flask run --host=0.0.0.0 --port=5000 --reload --debug |
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,5 @@ | ||
FROM mariadb:latest | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y mariadb-client && \ | ||
rm -rf /var/lib/apt/lists/* |
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 |
---|---|---|
@@ -1,32 +1,35 @@ | ||
# Use an official Python runtime as a parent image | ||
FROM python:3.11-alpine | ||
# Use an official Python runtime as a parent image, Alpine version for a lighter footprint | ||
FROM python:3.12-alpine | ||
|
||
# Install the MySQL client to be able to use it in the standby script. | ||
RUN apk add --no-cache mysql-client | ||
# Install MySQL client and temporary build dependencies | ||
RUN apk add --no-cache mysql-client \ | ||
&& apk add --no-cache --virtual .build-deps gcc musl-dev python3-dev libffi-dev openssl-dev | ||
|
||
# Set the working directory in the container to /app | ||
WORKDIR /app | ||
|
||
# Copy the contents of the local app/ directory to the /app directory in the container | ||
COPY app/ ./app | ||
|
||
# Copy requirements.txt at the /app working directory | ||
# Copy requirements.txt into the working directory /app | ||
COPY requirements.txt . | ||
|
||
# Copy the wait-for-db.sh script and set execution permissions | ||
COPY --chmod=+x scripts/wait-for-db.sh ./scripts/ | ||
|
||
# Install any needed packages specified in requirements.txt | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Update pip | ||
RUN pip install --no-cache-dir --upgrade pip | ||
# Install any needed packages specified in requirements.txt and upgrade pip | ||
RUN pip install --no-cache-dir -r requirements.txt \ | ||
&& pip install --no-cache-dir --upgrade pip \ | ||
&& apk del .build-deps | ||
|
||
# Copy the migration scripts to the /app directory in the container | ||
COPY migrations/ ./migrations | ||
|
||
# Expose port 5000 | ||
EXPOSE 5000 | ||
|
||
# Set environment variables for production | ||
ENV FLASK_ENV=production | ||
|
||
# Run the database migrations and then start the application with Gunicorn | ||
CMD sh ./scripts/wait-for-db.sh && flask db upgrade && gunicorn --bind 0.0.0.0:5000 app:app --log-level debug --timeout 3600 | ||
CMD sh ./scripts/wait-for-db.sh && flask db upgrade && gunicorn --bind 0.0.0.0:5000 app:app --log-level info --timeout 3600 |
Oops, something went wrong.