Skip to content
Merged
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
30 changes: 18 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM python:3.10-alpine AS builder

ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/bootstrap-service

COPY --from=ghcr.io/astral-sh/uv:0.6.5 /uv /uvx /bin/

RUN apk add --no-cache \
build-base \
Expand All @@ -10,20 +11,22 @@ RUN apk add --no-cache \

WORKDIR /install

# install private repo
RUN --mount=type=secret,id=github_token \
pip install --no-cache-dir --prefix=/install \
git+https://$(cat /run/secrets/github_token)@github.com/Space-DF/django-common-utils.git@dev
# Pinned by CI to the commit image-plan.py hashed into this image's content
# key. Defaults to dev so a hand build still works.
ARG COMMON_UTILS_REF=dev
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev

# install python requirements
COPY requirements.txt .
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
RUN --mount=type=secret,id=github_token \
uv pip install --no-cache --python /install/.venv/bin/python \
git+https://$(cat /run/secrets/github_token)@github.com/Space-DF/django-common-utils.git@${COMMON_UTILS_REF}

FROM python:3.10-alpine

ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/bootstrap-service
ENV PYTHONPATH=/app
ENV DJANGO_SETTINGS_MODULE=bootstrap_service.settings
ENV PATH="/install/.venv/bin:$PATH"

RUN apk add --no-cache \
curl \
Expand All @@ -33,13 +36,16 @@ RUN apk add --no-cache \

WORKDIR /app

# copy only installed python packages
COPY --from=builder /install /usr/local
COPY --from=builder /install/.venv /install/.venv

# copy source code
COPY . .

RUN adduser --disabled-password --gecos "" appuser \
&& chown -R appuser:appuser /app

RUN ["chmod", "+x", "./docker-entrypoint.sh"]

USER appuser

# Run the production server
ENTRYPOINT ["./docker-entrypoint.sh"]
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ git clone -b dev git@github.com:Space-DF/django-common-utils.git

## Setup

- Install requirements
- Install dependencies

```
pip install -r requirements.txt
uv sync
```

- Run RabbitMQ broker
Expand All @@ -36,23 +36,23 @@ git clone -b dev git@github.com:Space-DF/django-common-utils.git

- Migrate
```
python manage.py migrate
uv run python manage.py migrate
```
## Run source code
- Run server
```
python manage.py runserver 8000
uv run python manage.py runserver 8000
```

## Migration
When you make the change for the database model
- Make migration file
```
python manage.py makemigrations
uv run python manage.py makemigrations
```
- Migrate
```
python manage.py migrate_schemas
uv run python manage.py migrate_schemas
```

## License
Expand Down
30 changes: 30 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[project]
name = "spacedf-bootstrap-service"
version = "0.1.0"
description = "SpaceDF Bootstrap Service"
requires-python = ">=3.10,<3.11"
dependencies = [
"Django==5.2.16",
"celery==5.4.0",
"cryptography==50.0.0",
"python-dotenv==1.2.2",
"requests==2.33.0",
"gunicorn==22.0.0",
"gevent==24.2.1",
"drf-yasg==1.21.7",
"djangorestframework==3.17.2",
"djangorestframework-simplejwt==5.5.1",
"django-cors-headers==4.4.0",
"django-filter==24.2",
"django-environ==0.11.2",
"pika==1.3.2",
"django-redis==5.4.0",
"boto3==1.37.13",
"psycopg2-binary==2.9.9",
"django-tenants==3.10.2",
"django-silk==5.3.2",
"setuptools<81.0.0",
]

[tool.uv]
package = false
Loading
Loading