rework docker i dockerfile
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 1m38s

This commit is contained in:
Karl 2025-07-14 14:09:53 +01:00
parent 2fb86cb23d
commit 372d9f8889
4 changed files with 13 additions and 9 deletions

View File

@ -20,7 +20,6 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY . .
RUN chmod +x run.sh
ARG VERSION
RUN echo $VERSION > VERSION
@ -28,4 +27,5 @@ RUN echo $VERSION > VERSION
EXPOSE 3001
ENV FLASK_ENV=production
CMD ["./run.sh"]
RUN chmod +x run_docker.sh
CMD ["./run_docker.sh"]

View File

@ -19,4 +19,4 @@ class DevelopmentConfig(Config):
DEBUG = True
class ProductionConfig(Config):
PORT = os.environ.get('PORT', 5000)
PORT = os.environ.get('PORT', 3001)

6
run.sh
View File

@ -1,6 +0,0 @@
#!/bin/bash
if [ "$FLASK_ENV" = "production" ]; then
gunicorn --bind 0.0.0.0:3001 "ktvmanager.main:create_app()"
else
flask run --host=0.0.0.0 --port=3001
fi

10
run_docker.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash
if [ -f VERSION ]; then
echo "Version: $(cat VERSION)"
fi
# Extract port from config file
PORT=$(python -c "from ktvmanager.config import ProductionConfig; print(ProductionConfig.PORT)")
echo "Starting in production mode on port $PORT..."
gunicorn --bind 0.0.0.0:$PORT "ktvmanager.main:create_app()"