-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
76 additions
and
0 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,4 @@ | ||
__pycache__ | ||
.git | ||
.venv | ||
.week89 |
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,41 @@ | ||
# Use official Python image as the base image | ||
FROM python:3.10 | ||
|
||
# Set environment variables | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Copy and install system dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
build-essential \ | ||
libpq-dev \ | ||
curl \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Node.js and npm for TailwindCSS | ||
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ | ||
apt-get install -y nodejs && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy project dependencies first to improve caching | ||
COPY requirements.txt . | ||
RUN pip install --upgrade pip && pip install -r requirements.txt | ||
|
||
# Copy Node dependencies and install them | ||
COPY app/package.json . | ||
RUN npm install | ||
|
||
# Copy the rest of the project files | ||
COPY app/. . | ||
|
||
# Build CSS with Tailwind | ||
RUN npm run create-css | ||
|
||
# Expose port 5000 for the Flask app | ||
EXPOSE 5000 | ||
|
||
# Run the Flask app | ||
CMD ["flask", "run", "--host=0.0.0.0"] |
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,31 @@ | ||
version: '3.8' # Updated version for better features | ||
|
||
services: | ||
app: | ||
build: . | ||
container_name: flask_app | ||
command: flask run --host=0.0.0.0 | ||
ports: | ||
- "5000:5000" | ||
environment: | ||
FLASK_ENV: development | ||
DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB} | ||
volumes: | ||
- .:/app # This allows for live code updates; consider changing for production | ||
depends_on: | ||
- db | ||
restart: unless-stopped # Automatically restart unless stopped manually | ||
|
||
db: | ||
image: postgres:13 | ||
container_name: postgres_db | ||
environment: | ||
POSTGRES_USER: ${POSTGRES_USER} | ||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} | ||
POSTGRES_DB: ${POSTGRES_DB} | ||
volumes: | ||
- pgdata:/var/lib/postgresql/data | ||
restart: unless-stopped # Automatically restart unless stopped manually | ||
|
||
volumes: | ||
pgdata: |