diff --git a/.github/workflows/docker-build-test.yml b/.github/workflows/docker-build-test.yml index 1bd33a7fa..b1ef9c4ca 100644 --- a/.github/workflows/docker-build-test.yml +++ b/.github/workflows/docker-build-test.yml @@ -1,17 +1,18 @@ name: Deploy Backend to Preview ECS on: - push: - branches: [ "main" ] + pull_request: + branches: ["main"] paths: - - 'backend/core/**' + - "backend/core/**" env: - ECR_REPOSITORY: quivr # set this to your Amazon ECR repository name - ECS_SERVICE: quivr-preview # set this to your Amazon ECS service name - ECS_CLUSTER: quivr # set this to your Amazon ECS cluster name # file, e.g. .aws/task-definition.json - CONTAINER_NAME: quivr # set this to the name of the container in the - # containerDefinitions section of your task definition + ECR_REPOSITORY: quivr # set this to your Amazon ECR repository name + ECS_SERVICE: quivr-preview # set this to your Amazon ECS service name + ECS_CLUSTER: quivr # set this to your Amazon ECS cluster name # file, e.g. .aws/task-definition.json + CONTAINER_NAME: + quivr # set this to the name of the container in the + # containerDefinitions section of your task definition permissions: contents: read @@ -22,18 +23,17 @@ jobs: runs-on: ubuntu-latest defaults: run: - working-directory: ./backend/ + working-directory: ./backend/core environment: production steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 - - name: Build - id: build-image - run: | - # Build a docker container and - # push it to ECR so that it can - # be deployed to ECS. - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . - \ No newline at end of file + - name: Build + id: build-image + run: | + # Build a docker container and + # push it to ECR so that it can + # be deployed to ECS. + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . diff --git a/backend/core/Dockerfile b/backend/core/Dockerfile index 83be66b33..95b7c7d08 100644 --- a/backend/core/Dockerfile +++ b/backend/core/Dockerfile @@ -5,14 +5,14 @@ RUN apt-get update && apt-get install -y libgeos-dev pandoc WORKDIR /code -COPY ./core/requirements.txt /code/requirements.txt +COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir -r /code/requirements.txt --timeout 100 #You may need to run `chmod +x ./backend/core/scripts/start.sh` on your host machine if you get a permission error -COPY ./core/scripts/start.sh /code/scripts/start.sh +COPY ./scripts/start.sh /code/scripts/start.sh RUN chmod +x /code/scripts/start.sh -COPY ./core /code/ +COPY . /code ENTRYPOINT ["bash", "/code/scripts/start.sh"] diff --git a/backend/private/Dockerfile b/backend/private/Dockerfile index 9e94b3c8c..28b2d9dc8 100644 --- a/backend/private/Dockerfile +++ b/backend/private/Dockerfile @@ -8,13 +8,13 @@ RUN apt-get update && apt-get install -y liblzma-dev cmake git WORKDIR /app # Copy the requirements file -COPY ./private/requirements.txt /app/requirements.txt +COPY ./requirements.txt /app/requirements.txt # Install Python dependencies RUN pip install --no-cache-dir -r /app/requirements.txt --timeout 100 # Copy your application's code to the Docker container -COPY ./private /app +COPY . /app # Start the Uvicorn server on port 5051 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5051"] diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index b2818abe1..66309b70d 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -19,8 +19,8 @@ services: env_file: - ./backend/core/.env build: - context: backend - dockerfile: core/Dockerfile + context: backend/core + dockerfile: Dockerfile container_name: backend-core restart: always volumes: diff --git a/docker-compose.private-dev.yml b/docker-compose.private-dev.yml index 4d86fef20..b21d886d7 100644 --- a/docker-compose.private-dev.yml +++ b/docker-compose.private-dev.yml @@ -19,8 +19,8 @@ services: env_file: - ./backend/core/.env build: - context: backend - dockerfile: core/Dockerfile + context: backend/core + dockerfile: Dockerfile container_name: backend-core restart: always volumes: @@ -32,8 +32,8 @@ services: env_file: - ./backend/private/.env build: - context: backend - dockerfile: private/Dockerfile + context: backend/private + dockerfile: Dockerfile container_name: backend-private restart: always volumes: diff --git a/docker-compose.yml b/docker-compose.yml index db0dd2708..2140c7c6d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,8 +15,8 @@ services: env_file: - ./backend/core/.env build: - context: backend - dockerfile: core/Dockerfile + context: backend/core + dockerfile: Dockerfile container_name: backend-core restart: always volumes: