mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2025-09-02 02:30:07 +00:00
docker compose setup (#162)
Co-authored-by: Kerem Yilmaz <kerem@skyvern.com>
This commit is contained in:
parent
8c12e2bc20
commit
c0b4510ba8
9 changed files with 211 additions and 0 deletions
21
.dockerignore
Normal file
21
.dockerignore
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
**/videos
|
||||||
|
**/artifacts
|
||||||
|
**/traces
|
||||||
|
**/inputs
|
||||||
|
**/har
|
||||||
|
**/.git
|
||||||
|
**/.github
|
||||||
|
**/.mypy_cache
|
||||||
|
**/.venv
|
||||||
|
**/.vscode
|
||||||
|
*.env*
|
||||||
|
# Streamlit ignores
|
||||||
|
**/secrets*.toml
|
||||||
|
|
||||||
|
# Skyvern
|
||||||
|
docs
|
||||||
|
images
|
||||||
|
|
||||||
|
.dockerignore
|
||||||
|
.gitignore
|
||||||
|
Dockerfile
|
53
.github/workflows/build-docker-image.yml
vendored
Normal file
53
.github/workflows/build-docker-image.yml
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
name: Build Docker Image and Push to ECR
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [ published ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
AWS_REGION: us-east-1
|
||||||
|
ECR_REPOSITORY: skyvern
|
||||||
|
REGISTRY_ALIAS: t6d4b5t4 # skyvern
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-ci:
|
||||||
|
uses: ./.github/workflows/ci.yml
|
||||||
|
|
||||||
|
build-docker-image:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ run-ci ]
|
||||||
|
steps:
|
||||||
|
- name: Check out Git repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Configure AWS credentials
|
||||||
|
uses: aws-actions/configure-aws-credentials@v4
|
||||||
|
with:
|
||||||
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
aws-region: ${{ env.AWS_REGION }}
|
||||||
|
|
||||||
|
- name: Login to Amazon ECR Public
|
||||||
|
id: login-ecr-public
|
||||||
|
uses: aws-actions/amazon-ecr-login@v2
|
||||||
|
with:
|
||||||
|
registry-type: public
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Build, tag, and push image to Amazon Public ECR
|
||||||
|
id: build-image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
env:
|
||||||
|
ECR_REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: |
|
||||||
|
linux/amd64
|
||||||
|
linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ env.ECR_REGISTRY}}/${{ env.REGISTRY_ALIAS }}/${{ env.ECR_REPOSITORY }}:${{ github.sha }}
|
||||||
|
${{ env.ECR_REGISTRY}}/${{ env.REGISTRY_ALIAS }}/${{ env.ECR_REPOSITORY }}:${{ github.event.release.tag_name }}
|
||||||
|
${{ env.ECR_REGISTRY}}/${{ env.REGISTRY_ALIAS }}/${{ env.ECR_REPOSITORY }}:latest
|
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
|
@ -4,6 +4,7 @@ name: Run tests and pre-commit
|
||||||
# `branches: [main], then this actions runs _twice_ on pull requests, which is
|
# `branches: [main], then this actions runs _twice_ on pull requests, which is
|
||||||
# annoying.
|
# annoying.
|
||||||
on:
|
on:
|
||||||
|
workflow_call:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -164,6 +164,7 @@ artifacts/
|
||||||
traces/
|
traces/
|
||||||
*.pkl
|
*.pkl
|
||||||
har/
|
har/
|
||||||
|
postgres-data
|
||||||
|
|
||||||
# Streamlit ignores
|
# Streamlit ignores
|
||||||
**/secrets*.toml
|
**/secrets*.toml
|
||||||
|
|
34
Dockerfile
Normal file
34
Dockerfile
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
FROM python:3.11 as requirements-stage
|
||||||
|
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN pip install poetry
|
||||||
|
COPY ./pyproject.toml /tmp/pyproject.toml
|
||||||
|
COPY ./poetry.lock /tmp/poetry.lock
|
||||||
|
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
|
||||||
|
|
||||||
|
FROM python:3.11-slim-bookworm
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=requirements-stage /tmp/requirements.txt /app/requirements.txt
|
||||||
|
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
||||||
|
RUN pip install --no-cache-dir streamlit
|
||||||
|
RUN playwright install-deps
|
||||||
|
RUN playwright install
|
||||||
|
RUN apt-get install -y xauth && apt-get clean
|
||||||
|
|
||||||
|
COPY . /app
|
||||||
|
|
||||||
|
ENV PYTHONPATH="/app:$PYTHONPATH"
|
||||||
|
ENV VIDEO_PATH=/data/videos
|
||||||
|
ENV HAR_PATH=/data/har
|
||||||
|
ENV ARTIFACT_STORAGE_PATH=/data/artifacts
|
||||||
|
|
||||||
|
COPY ./entrypoint-skyvern.sh /app/entrypoint-skyvern.sh
|
||||||
|
RUN chmod +x /app/entrypoint-skyvern.sh
|
||||||
|
|
||||||
|
COPY ./entrypoint-streamlit.sh /app/entrypoint-streamlit.sh
|
||||||
|
RUN chmod +x /app/entrypoint-streamlit.sh
|
||||||
|
|
||||||
|
CMD [ "/bin/bash", "/app/entrypoint-skyvern.sh" ]
|
||||||
|
|
||||||
|
|
||||||
|
|
10
README.md
10
README.md
|
@ -105,6 +105,16 @@ Note: Our setup script does these two for you, but they are here for reference.
|
||||||
```
|
```
|
||||||
1. Navigate to `http://localhost:8501` in your browser to start using the UI
|
1. Navigate to `http://localhost:8501` in your browser to start using the UI
|
||||||
|
|
||||||
|
## Docker Compose setup
|
||||||
|
|
||||||
|
1. Fill in the LLM provider key on the [docker-compose.yml](./docker-compose.yml)
|
||||||
|
2. Run the following command:
|
||||||
|
```bash
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
3. Navigate to `http://localhost:8501` in your browser to start using the UI
|
||||||
|
|
||||||
|
|
||||||
## Additional Setup for Contributors
|
## Additional Setup for Contributors
|
||||||
If you're looking to contribute to Skyvern, you'll need to install the pre-commit hooks to ensure code quality and consistency. You can do this by running the following command:
|
If you're looking to contribute to Skyvern, you'll need to install the pre-commit hooks to ensure code quality and consistency. You can do this by running the following command:
|
||||||
```bash
|
```bash
|
||||||
|
|
64
docker-compose.yml
Normal file
64
docker-compose.yml
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:14-alpine
|
||||||
|
# comment out if you want to externally connect DB
|
||||||
|
# ports:
|
||||||
|
# - 5432:5432
|
||||||
|
volumes:
|
||||||
|
- ./postgres-data:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
- PGDATA=/var/lib/postgresql/data/pgdata
|
||||||
|
- POSTGRES_USER=skyvern
|
||||||
|
- POSTGRES_PASSWORD=skyvern
|
||||||
|
- POSTGRES_POSTGRES_DB=skyvern
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U skyvern"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
skyvern:
|
||||||
|
image: public.ecr.aws/t6d4b5t4/skyvern:latest
|
||||||
|
restart: on-failure
|
||||||
|
# comment out if you want to externally call skyvern API
|
||||||
|
# ports:
|
||||||
|
# - 8000:8000
|
||||||
|
volumes:
|
||||||
|
- ./artifacts:/data/artifacts
|
||||||
|
- ./videos:/data/videos
|
||||||
|
- ./har:/data/har
|
||||||
|
- ./.streamlit:/app/.streamlit
|
||||||
|
environment:
|
||||||
|
- DATABASE_STRING=postgresql+psycopg://skyvern:skyvern@postgres:5432/skyvern
|
||||||
|
- BROWSER_TYPE=chromium-headful
|
||||||
|
- ENABLE_OPENAI=true
|
||||||
|
- OPENAI_API_KEY=<your_openai_key>
|
||||||
|
# If you want to use other LLM provider, like azure and anthropic:
|
||||||
|
# - ENABLE_ANTHROPIC=true
|
||||||
|
# - ANTHROPIC_API_KEY=<your_anthropic_key>
|
||||||
|
# - ENABLE_AZURE=true
|
||||||
|
# - LLM_KEY=AZURE_OPENAI_GPT4V
|
||||||
|
# - AZURE_DEPLOYMENT=<your_azure_deployment>
|
||||||
|
# - AZURE_API_KEY=<your_azure_api_key>
|
||||||
|
# - AZURE_API_BASE=<your_azure_api_base>
|
||||||
|
# - AZURE_API_VERSION=<your_azure_api_version>
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
streamlit:
|
||||||
|
image: public.ecr.aws/t6d4b5t4/skyvern:latest
|
||||||
|
restart: on-failure
|
||||||
|
ports:
|
||||||
|
- 8501:8501
|
||||||
|
volumes:
|
||||||
|
- ./artifacts:/data/artifacts
|
||||||
|
- ./videos:/data/videos
|
||||||
|
- ./har:/data/har
|
||||||
|
- ./.streamlit:/app/.streamlit
|
||||||
|
command: ["/bin/bash", "entrypoint-streamlit.sh"]
|
||||||
|
depends_on:
|
||||||
|
- skyvern
|
||||||
|
|
20
entrypoint-skyvern.sh
Normal file
20
entrypoint-skyvern.sh
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# check alembic
|
||||||
|
alembic upgrade head
|
||||||
|
alembic check
|
||||||
|
|
||||||
|
if [ ! -f ".streamlit/secrets.toml" ]; then
|
||||||
|
echo "Creating organization and API token..."
|
||||||
|
org_output=$(python scripts/create_organization.py Skyvern-Open-Source)
|
||||||
|
api_token=$(echo "$org_output" | awk '/token=/{gsub(/.*token='\''|'\''.*/, ""); print}')
|
||||||
|
# Update the secrets-open-source.toml file
|
||||||
|
echo -e "[skyvern]\nconfigs = [\n {\"env\" = \"local\", \"host\" = \"http://skyvern:8000/api/v1\", \"orgs\" = [{name=\"Skyvern\", cred=\"$api_token\"}]}\n]" > .streamlit/secrets.toml
|
||||||
|
echo ".streamlit/secrets.toml file updated with organization details."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run the command and pass in all three arguments
|
||||||
|
xvfb-run python -m skyvern.forge
|
7
entrypoint-streamlit.sh
Normal file
7
entrypoint-streamlit.sh
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Run the command and pass in all three arguments
|
||||||
|
streamlit run streamlit_app/visualizer/streamlit.py --server.port 8501
|
Loading…
Add table
Reference in a new issue