generated from swiss-ai-center/create-a-new-service-generic-template
-
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.
Add Dockerfile and docker-compose.yml files to improve local developm…
…ent experience
- Loading branch information
Showing
2 changed files
with
28 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,2 @@ | ||
# Base image | ||
FROM python:3.10 |
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,26 @@ | ||
services: | ||
service: | ||
container_name: service | ||
build: | ||
context: . | ||
dockerfile: development.Dockerfile | ||
command: | | ||
bash -c " | ||
# Create the virtual environment | ||
python3.10 -m venv .venv && | ||
# Activate the virtual environment | ||
source .venv/bin/activate && | ||
# Install the dependencies | ||
pip install -r requirements.txt -r requirements-all.txt && | ||
# Run the service | ||
cd src && | ||
uvicorn --reload --host 0.0.0.0 --port 9090 main:app | ||
" | ||
environment: | ||
- ENGINE_URLS=["http://host.docker.internal:8080"] | ||
- SERVICE_URL=http://host.docker.internal:9090 | ||
ports: | ||
- 9090:9090 | ||
working_dir: /workspaces/service | ||
volumes: | ||
- .:/workspaces/service |