Skip to content
Open
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
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
echo """
venv/
*.pyc
__pycache__
.git
.env
*.egg-info
dist/
build/
""" > .dockerignore
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,4 @@ cython_debug/
models/
configs/
.pdm-python
.magemaker_configs
.env.save
63 changes: 48 additions & 15 deletions Dockerfile-server
Original file line number Diff line number Diff line change
@@ -1,22 +1,55 @@
# Use an official Python runtime as a parent image
FROM python:3.12-slim
FROM python:3.11-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
build-essential \
unzip \
nano \
vim \
gnupg \
lsb-release \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Set the working directory in the container
# Set working directory
WORKDIR /app

# Copy the project files to the working directory
COPY . .
# Copy your magemaker package
COPY . /app/

# Install PDM and use it to install dependencies
RUN pip install --no-cache-dir pdm \
&& pdm install --no-interactive
# Install package and dependencies
RUN pip install --no-cache-dir -e .

# Expose port 8000 to the outside world
EXPOSE 8000
# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install \
&& rm awscliv2.zip \
&& rm -rf aws

# Run uvicorn when the container launches
CMD ["pdm", "run", "uvicorn", "server:app", "--host", "0.0.0.0", "--port", "8000"]
# Install Google Cloud SDK
RUN curl https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-458.0.0-linux-x86_64.tar.gz -o google-cloud-sdk.tar.gz \
&& tar -xf google-cloud-sdk.tar.gz \
&& ./google-cloud-sdk/install.sh --quiet \
&& rm google-cloud-sdk.tar.gz

# Install Azure CLI
RUN mkdir -p /etc/apt/keyrings && \
curl -sLS https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/keyrings/microsoft.gpg > /dev/null && \
chmod go+r /etc/apt/keyrings/microsoft.gpg && \
echo "deb [arch=`dpkg --print-architecture` signed-by=/etc/apt/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/azure-cli.list && \
apt-get update && \
apt-get install -y azure-cli && \
rm -rf /var/lib/apt/lists/*

# Add Google Cloud SDK to PATH
ENV PATH $PATH:/app/google-cloud-sdk/bin

# Copy and setup entrypoint
COPY magemaker/docker/entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh

ENTRYPOINT ["entrypoint.sh"]
CMD ["bash"]
14 changes: 14 additions & 0 deletions magemaker/docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -e

# Setup AWS credentials if mounted
if [ -f "/root/.aws/credentials" ]; then
export AWS_SHARED_CREDENTIALS_FILE="/root/.aws/credentials"
fi

# Setup GCP credentials if mounted
if [ -f "/root/.config/gcloud/application_default_credentials.json" ]; then
export GOOGLE_APPLICATION_CREDENTIALS="/root/.config/gcloud/application_default_credentials.json"
fi

exec "$@"
218 changes: 0 additions & 218 deletions magemaker/sagemaker/create_model.py

This file was deleted.

17 changes: 0 additions & 17 deletions magemaker/sagemaker/delete_model.py

This file was deleted.

Loading
Loading