Skip to content

Commit 8c16989

Browse files
author
John Dutchover
committed
fixes
1 parent 40a0142 commit 8c16989

File tree

3 files changed

+15
-24
lines changed

3 files changed

+15
-24
lines changed

.gitlab-ci.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,10 @@ bandit:
7070
deploy-backend:
7171
stage: deploy
7272
script:
73-
- ls -la
74-
- echo "Content of the repository:"
75-
- ls -la $CI_PROJECT_DIR
73+
- ls -la $CI_PROJECT_DIR\app
74+
- ls -la $CI_PROJECT_DIR\app\requirements
7675
- flyctl auth token $FLY_API_TOKEN
77-
- flyctl deploy --ha=false --config app/fly.toml --remote-only -a insight-ai-api --debug
76+
- flyctl deploy --ha=false --config app/fly.toml --dockerfile app/Dockerfile -a insight-ai-api
7877
environment: production
7978
rules:
8079
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"'

app/.dockerignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@
2929
**/**/.ssh/id_*
3030
**/**/.ssh/*_id_*
3131

32-
# Makefile
33-
Makefile
34-
3532
# Configuration Files
3633
*.dockerignore
3734
.dockerignore

app/Dockerfile

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1+
# syntax=docker/dockerfile:1
12
# Use an official Python runtime as a parent image
2-
FROM python:3.11.7
3+
FROM python:3.11.7 as base
34

45
# Set the working directory in the Docker image
56
WORKDIR /usr/src/app
67

7-
# Create the requirements directory
8-
RUN mkdir requirements
8+
# Copy the entire app directory into the container at /usr/src/app
9+
COPY app/requirements/requirements.txt /usr/src/app
10+
# use trailing . to include hidden files
11+
COPY app/. /usr/src/app
912

10-
# Copy requirements.txt into the container at /usr/src/app/requirements/
11-
COPY requirements/requirements.txt requirements/
13+
# Create and activate a virtual environment
14+
RUN python -m venv venv
1215

13-
# Install dependencies
14-
RUN pip install --no-cache-dir -r requirements/requirements.txt
15-
16-
# Copy the .env file into the container at /usr/src/app
17-
COPY .env .
18-
# Copy the rest of the app directory contents into the container at /usr/src/app
19-
COPY . .
16+
# Activate the virtual environment and install dependencies
17+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
2018

2119
# Make port 8000 available to the world outside this container
2220
EXPOSE 8000
@@ -28,8 +26,5 @@ HEALTHCHECK --interval=5m --timeout=3s \
2826
--start-period=1m \
2927
CMD curl --fail http://localhost:8000/docs || exit 1
3028

31-
# Run main.py when the container launches
32-
CMD ["python", "main.py", "--host", "0.0.0.0", "--port", "8000"]
33-
34-
ENV APP_MODULE=main
35-
ENV MARVIN_OPENAI_CHAT_COMPLETIONS_MODEL=gpt-3.5-turbo
29+
# Set entrypoint for FastAPI when the container launches
30+
ENTRYPOINT ["python", "main.py"]

0 commit comments

Comments
 (0)