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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,7 @@ cython_debug/
*.code-workspace
.github/workflows/_*.yml

uv.lock
uv.lock
docker/.env copy

*.DS_Store
92 changes: 92 additions & 0 deletions docker/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Git
.git
.gitignore
.gitattributes


# CI
.codeclimate.yml
.travis.yml
.taskcluster.yml

# Docker
docker-compose.yml
Dockerfile
.docker
.dockerignore

# Byte-compiled / optimized / DLL files
**/__pycache__/
**/*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Virtual environment
.env
.venv/
venv/

# PyCharm
.idea

# Python mode for VIM
.ropeproject
**/.ropeproject

# Vim swap files
**/*.swp

# VS Code
.vscode/


.venv
60 changes: 10 additions & 50 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,62 +1,22 @@
FROM python:3.10.13-slim-bookworm as build

FROM python:3.12-slim-bookworm as build
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends build-essential gcc && \
apt-get install -y git # for installing directly from git

ARG PIP_DISABLE_PIP_VERSION_CHECK=1
ARG PIP_NO_CACHE_DIR=1

WORKDIR /python

RUN python -m venv /python/venv

ENV PATH="/python/venv/bin:$PATH"

COPY docker/requirements.txt .
RUN pip install -r requirements.txt

RUN pip install oqd-compiler-infrastructure
RUN pip install oqd-core
RUN pip install oqd-analog-emulator


########################################################################################

FROM python:3.10.13-slim-bookworm as app

RUN apt update && \
apt install -y --no-install-recommends supervisor && \
apt-get install -y git && \
apt-get install -y gcc g++ # needed from Cython


ARG PIP_DISABLE_PIP_VERSION_CHECK=1
ARG PIP_NO_CACHE_DIR=1

COPY --from=build /python/venv /python/venv

ENV PATH="/python/venv/bin:$PATH"
ENV PYTHONPATH="/app/src"

COPY . ./app
ENV PYTHONPATH="/app/src"
WORKDIR /app
RUN pip install .
#RUN pip install .[all]

#COPY ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ./docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

########################################################################################
RUN uv venv
ENV PATH=".venv/bin:$PATH"

# RUN \
# apt update \
# && apt install wget -y \
# && wget https://julialang-s3.julialang.org/bin/linux/x64/1.9/julia-1.9.3-linux-x86_64.tar.gz -P /opt \
# && tar zxvf /opt/julia-1.9.3-linux-x86_64.tar.gz -C /opt
RUN uv pip install ".[server]"

# ENV PATH "$PATH:/opt/julia-1.9.3/bin"
COPY ./docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

# RUN julia -e 'using Pkg; Pkg.add(["QuantumOptics", "Configurations", "StatsBase", "DataStructures", "JSON3", "IonSim"])'
########################################################################################
151 changes: 111 additions & 40 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,39 @@ networks:
internal:
name: oqd-cloud-server-internal

volumes:
redis_volume:
driver: local
postgres_volume:
driver: local
minio_volume:
driver: local


################################################################################

services:
minio:
image: minio/minio
container_name: minio
restart: always
ports:
- '9000:9000'
- '9001:9001'
# network_mode: "host"
networks:
internal:
volumes:
- 'minio_volume:/data'
environment:
- MINIO_ROOT_USER=${MINIO_ROOT_USER}
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}
- MINIO_DEFAULT_BUCKETS=${MINIO_DEFAULT_BUCKETS}
command: server /data --console-address ":9001"

redis:
image: redis
container_name: oqd-cloud-server-redis
container_name: redis
restart: always
healthcheck:
test: ["CMD-SHELL", "redis-cli -a $${REDIS_PASSWORD} --raw incr _docker_healthcheck"]
Expand All @@ -22,16 +49,19 @@ services:
environment:
REDIS_PASSWORD: ${REDIS_PASSWORD} # Replace
command: ["sh", "-c", "redis-server --requirepass $${REDIS_PASSWORD} --save 20 1 --loglevel notice --appendonly yes --appendfsync everysec"]
expose:
- "6379"
ports:
- "6379:6379"
# expose:
# - "6379"
# network_mode: "host"
networks:
internal:
volumes:
- redis_volume:/data

postgres:
image: postgres
container_name: oqd-cloud-server-postgres
container_name: postgres
restart: always
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} # Replace
Expand All @@ -43,45 +73,86 @@ services:
interval: 5s
timeout: 25s
retries: 5
expose:
- "5432"
# expose:
# - "5432"
ports:
- "5432:5432"
# network_mode: "host"
networks:
internal:
volumes:
- postgres_volume:/var/lib/postgres/data

app:
build:
context: ../
dockerfile: docker/Dockerfile
args:
GITHUB_TOKEN: ${GITHUB_TOKEN}
image: oqd-cloud-server
container_name: oqd-cloud-server
restart: always
environment:
REDIS_HOST: ${REDIS_HOST}
REDIS_PASSWORD: ${REDIS_PASSWORD}
POSTGRES_HOST: ${POSTGRES_HOST}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
JWT_SECRET_KEY: ${JWT_SECRET_KEY}
JWT_ALGORITHM: ${JWT_ALGORITHM}
JWT_ACCESS_TOKEN_EXPIRE_MINUTES: ${JWT_ACCESS_TOKEN_EXPIRE_MINUTES}
RQ_WORKERS: 4
ports:
- "8000:8000"
networks:
internal:
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy

volumes:
redis_volume:
driver: local
postgres_volume:
driver: local
# app:
# image: oqd-cloud-server # Use existing built image
# container_name: oqd-cloud-server
# restart: always
# environment:
# REDIS_HOST: ${REDIS_HOST}
# REDIS_PASSWORD: ${REDIS_PASSWORD}
# POSTGRES_HOST: ${POSTGRES_HOST}
# POSTGRES_USER: ${POSTGRES_USER}
# POSTGRES_DB: ${POSTGRES_DB}
# POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
# JWT_SECRET_KEY: ${JWT_SECRET_KEY}
# JWT_ALGORITHM: ${JWT_ALGORITHM}
# JWT_ACCESS_TOKEN_EXPIRE_MINUTES: ${JWT_ACCESS_TOKEN_EXPIRE_MINUTES}
# RQ_WORKERS: 4
# MINIO_ROOT_USER: ${MINIO_ROOT_USER}
# MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
# MINIO_DEFAULT_BUCKETS: ${MINIO_DEFAULT_BUCKETS}
# ports:
# - "8000:8000"
# networks:
# - internal
# volumes:
# - ../:/app # Bind-mount your code
# working_dir: /app # Set working directory inside container
# # command: uv run src/oqd_cloud/server/main.py
# command: uv run src/oqd_cloud/server/main.py
# # command: >
# # /bin/sh -c "
# # source .venv/bin/activate
# # uvicorn main:app --host 0.0.0.0 --port 8000 --reload
# # "
# depends_on:
# redis:
# condition: service_healthy
# postgres:
# condition: service_healthy


# app:
# build:
# context: ../
# dockerfile: docker/Dockerfile
# args:
# GITHUB_TOKEN: ${GITHUB_TOKEN}
# image: oqd-cloud-server
# container_name: oqd-cloud-server
# restart: always
# environment:
# REDIS_HOST: ${REDIS_HOST}
# REDIS_PASSWORD: ${REDIS_PASSWORD}
# POSTGRES_HOST: ${POSTGRES_HOST}
# POSTGRES_USER: ${POSTGRES_USER}
# POSTGRES_DB: ${POSTGRES_DB}
# POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
# JWT_SECRET_KEY: ${JWT_SECRET_KEY}
# JWT_ALGORITHM: ${JWT_ALGORITHM}
# JWT_ACCESS_TOKEN_EXPIRE_MINUTES: ${JWT_ACCESS_TOKEN_EXPIRE_MINUTES}
# RQ_WORKERS: 4
# MINIO_ROOT_USER: ${MINIO_ROOT_USER}
# MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
# MINIO_DEFAULT_BUCKETS: ${MINIO_DEFAULT_BUCKETS}
# ports:
# - "8000:8000"
# networks:
# internal:
# depends_on:
# redis:
# condition: service_healthy
# postgres:
# condition: service_healthy

9 changes: 0 additions & 9 deletions docker/requirements.txt

This file was deleted.

Loading
Loading