Skip to content

Commit

Permalink
[cloud]
Browse files Browse the repository at this point in the history
  • Loading branch information
kyegomez committed Feb 3, 2025
1 parent 8e7b3c9 commit bafb82c
Show file tree
Hide file tree
Showing 8 changed files with 430 additions and 368 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ eggs/
.terraform
.eggs/
lib/
agent_workspace/
lib64/
lambda/node_modules/
errors.txt
Expand Down
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM python:3.11-slim

# Set environment variables to ensure Python output is logged and bytecode is not written
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1

# Set working directory
WORKDIR /app

# Copy the requirements file first for dependency caching
COPY api/requirements.txt .

# Install build dependencies, then install Python dependencies, and finally remove build tools
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc build-essential && \
pip install --upgrade pip && \
pip install -r requirements.txt && \
apt-get purge -y --auto-remove gcc build-essential && \
rm -rf /var/lib/apt/lists/*

# Copy the API source code into the container
COPY api/ .

# Create a non-root user and change ownership of the application folder
RUN adduser --disabled-password --gecos "" appuser && \
chown -R appuser /app
USER appuser

# Expose port 80 for the application
EXPOSE 80

# Start the API using Gunicorn with Uvicorn workers
CMD ["gunicorn", "api:app", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:80"]
40 changes: 0 additions & 40 deletions agent.yaml

This file was deleted.

Loading

0 comments on commit bafb82c

Please sign in to comment.