Deployment
This section outlines how the application is packaged and deployed within the Helix ecosystem.
Deployment Options
The application supports two deployment options:
- Docker: The application can be deployed as a Docker image.
- Helix Serverless: The application can be deployed as a serverless function.
Docker Deployment
Dockerfile
The Dockerfile
defines the steps required to build the Docker image:
FROM python:3.9-slim
# Set the working directory
WORKDIR /app
# Copy the application code to the container
COPY . .
# Install the required dependencies
RUN pip install -r requirements.txt
# Expose the application port
EXPOSE 8000
# Define the command to run the application
CMD ["python", "main.py"]
Building the Docker Image
docker build -t <image_name>:<tag> .
Running the Docker Image
docker run -p 8000:8000 <image_name>:<tag>
Helix Serverless Deployment
Deployment Configuration
The helix.yaml
file specifies the serverless deployment configuration:
name: my-python-app
runtime: python3.9
entry_point: main.handler
Deploying the Application
helix deploy
Invoking the Function
helix invoke my-python-app
Example: Deploying the Application as a Docker Image
- Build the Docker image:
docker build -t my-python-app:latest .
- Run the Docker image:
docker run -p 8000:8000 my-python-app:latest
Example: Deploying the Application as a Serverless Function
- Configure the deployment:
name: my-python-app
runtime: python3.9
entry_point: main.handler
- Deploy the application:
helix deploy
- Invoke the function:
helix invoke my-python-app