Spaces:
Runtime error
Runtime error
Soutrik
commited on
Commit
·
240148f
1
Parent(s):
c6e88ba
basic config docker file set
Browse files- .gitignore +4 -1
- Dockerfile +35 -0
- docker-compose.yaml +20 -0
- pyproject.toml +0 -1
.gitignore
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
aws/
|
| 2 |
-
*.zip
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
aws/
|
| 2 |
+
*.zip
|
| 3 |
+
*.tar.gz
|
| 4 |
+
*.tar.bz2
|
| 5 |
+
.env
|
Dockerfile
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Python base image
|
| 2 |
+
FROM python:3.10.15-slim
|
| 3 |
+
|
| 4 |
+
# Set environment variables
|
| 5 |
+
ENV POETRY_VERSION=1.6.1 \
|
| 6 |
+
POETRY_HOME="/opt/poetry" \
|
| 7 |
+
POETRY_VIRTUALENVS_IN_PROJECT=true \
|
| 8 |
+
PYTHONUNBUFFERED=1
|
| 9 |
+
|
| 10 |
+
# Install Poetry
|
| 11 |
+
RUN apt-get update && apt-get install -y curl \
|
| 12 |
+
&& curl -sSL https://install.python-poetry.org | python3 - \
|
| 13 |
+
&& ln -s ${POETRY_HOME}/bin/poetry /usr/local/bin/poetry \
|
| 14 |
+
&& apt-get clean \
|
| 15 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
+
|
| 17 |
+
# Set working directory
|
| 18 |
+
WORKDIR /app
|
| 19 |
+
|
| 20 |
+
# Copy Poetry files for dependency installation
|
| 21 |
+
COPY pyproject.toml poetry.lock ./
|
| 22 |
+
|
| 23 |
+
# Install dependencies with Poetry
|
| 24 |
+
RUN poetry install --no-root --only main
|
| 25 |
+
|
| 26 |
+
# Copy the source code
|
| 27 |
+
COPY src/ src/
|
| 28 |
+
# copy app
|
| 29 |
+
COPY app/ app/
|
| 30 |
+
|
| 31 |
+
# Set entrypoint to ensure Poetry's virtual environment is used
|
| 32 |
+
ENTRYPOINT ["poetry", "run"]
|
| 33 |
+
|
| 34 |
+
# Default command to run `src.test_infra`
|
| 35 |
+
CMD ["python", "-m", "src.test_infra"]
|
docker-compose.yaml
CHANGED
|
@@ -41,6 +41,26 @@ services:
|
|
| 41 |
depends_on:
|
| 42 |
- redis
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
volumes:
|
| 45 |
postgres_data:
|
| 46 |
|
|
|
|
| 41 |
depends_on:
|
| 42 |
- redis
|
| 43 |
|
| 44 |
+
app:
|
| 45 |
+
build:
|
| 46 |
+
context: .
|
| 47 |
+
dockerfile: Dockerfile # Assumes the Dockerfile is in the root directory
|
| 48 |
+
environment:
|
| 49 |
+
- DATABASE_URL=${DATABASE_URL}
|
| 50 |
+
- REDIS_URL=${REDIS_URL}
|
| 51 |
+
- BROKER_URL=${BROKER_URL}
|
| 52 |
+
- FLOWER_BASIC_AUTH=${FLOWER_BASIC_AUTH}
|
| 53 |
+
- POSTGRES_DB=${POSTGRES_DB}
|
| 54 |
+
- POSTGRES_USER=${POSTGRES_USER}
|
| 55 |
+
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
| 56 |
+
- DOCKER_ENV=1
|
| 57 |
+
depends_on:
|
| 58 |
+
postgres:
|
| 59 |
+
condition: service_healthy
|
| 60 |
+
redis:
|
| 61 |
+
condition: service_healthy
|
| 62 |
+
command: ["python", "-m", "src.test_infra"]
|
| 63 |
+
|
| 64 |
volumes:
|
| 65 |
postgres_data:
|
| 66 |
|
pyproject.toml
CHANGED
|
@@ -5,7 +5,6 @@ description = "Basic template testing pytorch fastapi application on aws infra u
|
|
| 5 |
authors = ["Soutrik Chowdhury"]
|
| 6 |
license = "Apache-2.0"
|
| 7 |
readme = "README.md"
|
| 8 |
-
package-mode = false
|
| 9 |
|
| 10 |
[tool.poetry.dependencies]
|
| 11 |
python = "3.10.15"
|
|
|
|
| 5 |
authors = ["Soutrik Chowdhury"]
|
| 6 |
license = "Apache-2.0"
|
| 7 |
readme = "README.md"
|
|
|
|
| 8 |
|
| 9 |
[tool.poetry.dependencies]
|
| 10 |
python = "3.10.15"
|