Moved frontend out of webserver into it's own container

This commit is contained in:
2025-01-23 11:28:53 +00:00
parent e826311c34
commit c0674c58b4
50 changed files with 41 additions and 12 deletions

View File

@@ -15,14 +15,22 @@ services:
build:
context: ./web_server
ports:
- "5000:5000"
- "5000"
networks:
- app_network
env_file:
- .env
environment:
- FLASK_APP=backend.blueprints.__init__
- FLASK_APP=blueprints.__init__
- FLASK_DEBUG=True
frontend:
build:
context: ./frontend
ports:
- "5173:5173"
networks:
- app_network
networks:
app_network:

20
frontend/Dockerfile Normal file
View File

@@ -0,0 +1,20 @@
# Use the latest LTS version of Node.js
FROM node:18-alpine
# Set the working directory inside the container
WORKDIR /frontend
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of your application files
COPY . .
# Expose the port your app runs on
EXPOSE 5173
# Define the command to run your app
CMD ["npm", "run", "dev"]

View File

@@ -31,6 +31,7 @@
"tailwindcss": "^3.4.17",
"typescript": "~5.6.2",
"typescript-eslint": "^8.18.2",
"vite": "^6.0.5"
"vite": "^6.0.5",
"lucide-react": "0.473.0"
}
}

View File

Before

Width:  |  Height:  |  Size: 844 KiB

After

Width:  |  Height:  |  Size: 844 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 167 KiB

After

Width:  |  Height:  |  Size: 167 KiB

View File

Before

Width:  |  Height:  |  Size: 372 KiB

After

Width:  |  Height:  |  Size: 372 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 6.5 MiB

After

Width:  |  Height:  |  Size: 6.5 MiB

View File

@@ -19,8 +19,8 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# Set environment variables
ENV FLASK_APP=backend.blueprints.__init__
ENV FLASK_APP=blueprints.__init__
ENV FLASK_DEBUG=True
# Start the Flask app
CMD ["gunicorn", "-b", "0.0.0.0:5000", "backend.blueprints.__init__:create_app()"]
CMD ["gunicorn", "-b", "0.0.0.0:5000", "blueprints.__init__:create_app()"]

View File

@@ -1,6 +1,6 @@
from flask import Flask
from flask_session import Session
from backend.blueprints.utils import logged_in_user
from blueprints.utils import logged_in_user
from flask_cors import CORS
import os
@@ -21,9 +21,9 @@ def create_app():
app.before_request(logged_in_user)
with app.app_context():
from backend.blueprints.authentication import auth_bp
from backend.blueprints.main import main_bp
from backend.blueprints.stripe import stripe_bp
from blueprints.authentication import auth_bp
from blueprints.main import main_bp
from blueprints.stripe import stripe_bp
app.register_blueprint(auth_bp)
app.register_blueprint(main_bp)

View File

@@ -1,8 +1,8 @@
from flask import Blueprint, render_template, session, request, url_for, redirect, g
from werkzeug.security import generate_password_hash, check_password_hash
from backend.forms import SignupForm, LoginForm
from backend.database.database import Database
from backend.blueprints.utils import login_required
from forms import SignupForm, LoginForm
from database.database import Database
from blueprints.utils import login_required
auth_bp = Blueprint("auth", __name__)