Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
John Dutchover committed Feb 10, 2024
1 parent 40a0142 commit 8c16989
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 24 deletions.
7 changes: 3 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ bandit:
deploy-backend:
stage: deploy
script:
- ls -la
- echo "Content of the repository:"
- ls -la $CI_PROJECT_DIR
- ls -la $CI_PROJECT_DIR\app
- ls -la $CI_PROJECT_DIR\app\requirements
- flyctl auth token $FLY_API_TOKEN
- flyctl deploy --ha=false --config app/fly.toml --remote-only -a insight-ai-api --debug
- flyctl deploy --ha=false --config app/fly.toml --dockerfile app/Dockerfile -a insight-ai-api
environment: production
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"'
Expand Down
3 changes: 0 additions & 3 deletions app/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
**/**/.ssh/id_*
**/**/.ssh/*_id_*

# Makefile
Makefile

# Configuration Files
*.dockerignore
.dockerignore
Expand Down
29 changes: 12 additions & 17 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
# syntax=docker/dockerfile:1
# Use an official Python runtime as a parent image
FROM python:3.11.7
FROM python:3.11.7 as base

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

# Create the requirements directory
RUN mkdir requirements
# Copy the entire app directory into the container at /usr/src/app
COPY app/requirements/requirements.txt /usr/src/app
# use trailing . to include hidden files
COPY app/. /usr/src/app

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

# Install dependencies
RUN pip install --no-cache-dir -r requirements/requirements.txt

# Copy the .env file into the container at /usr/src/app
COPY .env .
# Copy the rest of the app directory contents into the container at /usr/src/app
COPY . .
# Activate the virtual environment and install dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt

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

# Run main.py when the container launches
CMD ["python", "main.py", "--host", "0.0.0.0", "--port", "8000"]

ENV APP_MODULE=main
ENV MARVIN_OPENAI_CHAT_COMPLETIONS_MODEL=gpt-3.5-turbo
# Set entrypoint for FastAPI when the container launches
ENTRYPOINT ["python", "main.py"]

0 comments on commit 8c16989

Please sign in to comment.