forked from WecoAI/aideml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request WecoAI#18 from dexhunter/feat/docker
🐳 Add Dockerfile
- Loading branch information
Showing
3 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.git | ||
.gitignore | ||
logs/ | ||
workspaces/ | ||
__pycache__/ | ||
*.pyc | ||
*.pyo | ||
*.pyd | ||
.Python | ||
*.so | ||
*.egg | ||
*.egg-info/ | ||
.env | ||
.venv | ||
.coverage | ||
.pytest_cache/ | ||
.mypy_cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Build stage | ||
FROM python:3.10-slim AS builder | ||
|
||
# Install build dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
gcc \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Copy only the files needed for installation | ||
COPY requirements.txt setup.py README.md ./ | ||
COPY aide ./aide | ||
|
||
# Create virtual environment and install dependencies | ||
RUN python -m venv /opt/venv && \ | ||
. /opt/venv/bin/activate && \ | ||
pip install --no-cache-dir -r requirements.txt && \ | ||
pip install -e . | ||
|
||
# Runtime stage | ||
FROM python:3.10-slim | ||
|
||
# Install runtime dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
unzip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Create non-root user | ||
RUN useradd -m -u 1000 aide | ||
|
||
# Copy virtual environment from builder | ||
COPY --from=builder /opt/venv /opt/venv | ||
# Copy the package files needed for the installation | ||
COPY --from=builder /app /app | ||
ENV PATH="/opt/venv/bin:$PATH" | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Create and set permissions for logs and workspaces | ||
RUN mkdir -p logs workspaces && \ | ||
chown -R aide:aide /app | ||
|
||
# Switch to non-root user | ||
USER aide | ||
|
||
# Set default command | ||
ENTRYPOINT ["aide"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters