1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

чиним билд17

This commit is contained in:
MoonTestUse1
2025-01-02 00:55:37 +06:00
parent fa1f027711
commit dc69508f1c
3 changed files with 14 additions and 24 deletions

View File

@@ -19,8 +19,17 @@ RUN pip install --no-cache-dir -r requirements.txt
# Copy application code # Copy application code
COPY . . COPY . .
# Create script to run migrations and start app
RUN echo '#!/bin/sh\n\
echo "Waiting for database..."\n\
sleep 5\n\
echo "Running migrations..."\n\
alembic upgrade head\n\
echo "Starting application..."\n\
python run.py' > /app/start.sh && chmod +x /app/start.sh
# Expose port # Expose port
EXPOSE 8000 EXPOSE 8000
# Run migrations and start application # Run migrations and start application
CMD ["sh", "-c", "alembic upgrade head && python run.py"] CMD ["/app/start.sh"]

View File

@@ -2,26 +2,4 @@
\c support_db; \c support_db;
-- Create extensions if needed -- Create extensions if needed
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- Create tables if they don't exist
CREATE TABLE IF NOT EXISTS employees (
id SERIAL PRIMARY KEY,
first_name VARCHAR NOT NULL,
last_name VARCHAR NOT NULL,
department VARCHAR NOT NULL,
office VARCHAR NOT NULL,
password VARCHAR NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS requests (
id SERIAL PRIMARY KEY,
employee_id INTEGER REFERENCES employees(id),
department VARCHAR NOT NULL,
request_type VARCHAR NOT NULL,
priority VARCHAR NOT NULL,
description TEXT NOT NULL,
status VARCHAR NOT NULL DEFAULT 'new',
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);

View File

@@ -23,6 +23,7 @@ services:
condition: service_healthy condition: service_healthy
networks: networks:
- support-network - support-network
restart: unless-stopped
postgres: postgres:
image: postgres:15 image: postgres:15
@@ -40,8 +41,10 @@ services:
interval: 5s interval: 5s
timeout: 5s timeout: 5s
retries: 5 retries: 5
start_period: 5s
networks: networks:
- support-network - support-network
restart: unless-stopped
networks: networks:
support-network: support-network: