I'm trying run my App by docker-compose but I have problem with my ports. When I use command docker-compose --build the application runs on port 5000, although I have a completely different port established ,so only the Login view is displayed strong text
Terminal:
FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True or False to suppress this warning.
components["port"] = int(components["port"])
When you try login:
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
Docker-compose:
version: "3.9"
services:
app:
build:
context: ..
dockerfile: app/Dockerfile
container_name: app
ports:
- "5005:5005"
entrypoint: ./entrypoint.sh
environment:
- POSTGRES_USERNAME=${POSTGRES_USERNAME}
- POSTGER_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_PORT=${POSTGRES_PORT}
- POSTGRES_DATABASE=${POSTGRES_DATABASE}
- SECRET_KEY=${SECRET_KEY}
hostname: subscription-app
depends_on:
db:
condition: service_healthy
db:
restart: always
image: postgres:14.3-alpine3.16
container_name: ${POSTGRES_HOST}
environment:
- POSTGRES_USER=${POSTGRES_USERNAME}
- POSTGRES_DB=${POSTGRES_DATABASE}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_PORT_INTERNAL=${POSTGRES_PORT_INTERNAL}
ports:
- "${POSTGRES_PORT}:${POSTGRES_PORT_INTERNAL}"
hostname: ${POSTGRES_HOST}
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
interval: 5s
timeout: 30s
retries: 6
Dockerfile:
FROM python:3.8-slim
WORKDIR /app
COPY .requirements/requirements.txt .
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
COPY app .
ENV FLASK_APP=.
COPY entrypoint.sh entrypoint.sh
ENV FLASK_ENV=development
RUN chmod u+x entrypoint.sh
CMD [ "entrypoint.sh" ]
Entrypoint.sh:
#!/bin/sh
flask db migrate
flask db upgrade
flask run --host="${HOST}"