Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM mcr.microsoft.com/devcontainers/python:3.11-bookworm

COPY ./app/requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r app/requirements.txt
RUN pip install --no-cache-dir poetry
COPY ./app/pyproject.toml /app/pyproject.toml
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi

COPY ./app /app

62 changes: 62 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build
on:
push:
branches:
- '**'

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Install Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Checkout Repo
uses: actions/checkout@v4
- name: Set up Docker cache
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: buildx-${{ runner.os }}-${{ github.sha }}
restore-keys: |
buildx-${{ runner.os }}-
- name: Build Docker image
working-directory: ./app
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
--cache-from type=local,src=/tmp/.buildx-cache \
--cache-to type=local,dest=/tmp/.buildx-cache \
.

test:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Checkout Repo
uses: actions/checkout@v4

- name: Set up cache for Poetry dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: poetry-${{ hashFiles('app/poetry.lock') }}

- name: Install Python dependencies with Poetry
working-directory: ./app
run: poetry install --no-interaction --no-root

- name: Run intercom test
working-directory: ./app
run: poetry run python test_intercom.py
14 changes: 9 additions & 5 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install poetry
run: pipx install poetry

- name: Checkout Repo
uses: actions/checkout@v4

Expand All @@ -35,15 +39,15 @@ jobs:
role-duration-seconds: 1200
role-to-assume: arn:aws:iam::407839483216:role/admin

- name: Set up cache for pip dependencies
- name: Set up cache for Poetry dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('app/requirements.txt') }}
path: ~/.cache/pypoetry
key: poetry-${{ hashFiles('app/poetry.lock') }}

- name: Install Python dependencies
- name: Install Python dependencies with Poetry
working-directory: ./app
run: pip install -r requirements.txt
run: poetry install --no-interaction --no-root

- name: Update knowledge_base.json
working-directory: ./app
Expand Down
13 changes: 4 additions & 9 deletions app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,18 @@ RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \
apt-get install -y nodejs

# Install uWSGI and GitPython
RUN pip install uwsgi gitpython
RUN pip install --no-cache-dir poetry uwsgi gitpython

# Copy the requirements file first to leverage Docker's cache
COPY requirements.txt /app/

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy poetry files
COPY pyproject.toml poetry.lock* ./
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi --no-root

# Copy the application source code into the container
COPY . /app

# Expose port 5050 for the Flask application
EXPOSE 5050

# Run test file
RUN python test_intercom.py

# Define environment variable for Flask
ENV FLASK_APP=app.py

Expand Down
Loading
Loading