diff --git a/Dockerfile b/Dockerfile index 153e390..03d46a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,11 @@ # For more information, please refer to https://aka.ms/vscode-docker-python FROM python:3.10-slim +# Install Node.js +RUN apt-get update && apt-get install -y curl +RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - +RUN apt-get install -y nodejs + EXPOSE 8000 # Keeps Python from generating .pyc files in the container @@ -20,9 +25,16 @@ RUN pip install pipenv && pipenv install --dev --system --deploy # Install async-timeout and numpy RUN pip install async-timeout numpy exceptiongroup +# Copy and build the Vite project +COPY static/package*.json /app/static/ +WORKDIR /app/static +RUN npm install +RUN npm run build + # Copy the rest of the application files into the container COPY src /app/src COPY static /app/static/ +COPY --from=vite-build /app/static/dist /app/static/dist # Creates a non-root user with an explicit UID and adds permission to access the /app folder RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app diff --git a/docker-compose.yml b/docker-compose.yml index f633681..fecf5f9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,8 +9,6 @@ services: restart: always ports: - '6379:6379' - networks: - - etlnetwork postgres: image: postgres:latest @@ -23,8 +21,6 @@ services: POSTGRES_DB: 'postgres' volumes: - postgres_data:/var/lib/postgresql/data - networks: - - etlnetwork pipeline: image: etl-pipeline @@ -32,8 +28,6 @@ services: context: . dockerfile: ./Dockerfile command: ['python', 'src/main.py'] - networks: - - etlnetwork api: image: etl-api @@ -43,9 +37,3 @@ services: command: ['uvicorn', 'src.api:app', '--host', '0.0.0.0', '--port', '80'] ports: - '80:80' - networks: - - etlnetwork - -networks: - etlnetwork: - driver: bridge