Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update docker deploy commands #30

Merged
merged 5 commits into from
Dec 21, 2024
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
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry config virtualenvs.create false
poetry install
poetry install --sync --no-interaction

- name: Run lint
run: make lint
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry config virtualenvs.create false
poetry install
poetry install --sync --no-interaction

- name: Run tests
run: make test
Expand All @@ -106,7 +106,7 @@ jobs:
fail_ci_if_error: false

build:
name: Build Docker Images
name: Build Test
needs: commit-check
runs-on: ubuntu-latest
steps:
Expand All @@ -130,7 +130,7 @@ jobs:
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry config virtualenvs.create false
poetry install
poetry install --sync --no-interaction

- name: Set up Docker
uses: docker/setup-buildx-action@v3
Expand All @@ -139,7 +139,7 @@ jobs:
run: make build

integration-tests:
name: Integration Tests (${{ matrix.component }})
name: ${{ matrix.component }}
needs: [lint, test, build]
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
run: |
pip install python-semantic-release==7.34.6
git pull --rebase
python -m semantic_release publish --patch
python -m semantic_release publish

publish:
name: Publish Docker Images
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ docker-compose up -d --build

Run the app in production
```bash
GIT_TAG=v0.1.28 ./deploy.sh
GIT_TAG=v0.1.28 ./run.sh
```

### Local Development
Expand All @@ -62,7 +62,7 @@ GIT_TAG=v0.1.28 ./deploy.sh

```bash
python3.12 -m pip install poetry -U
poetry install
poetry install --sync --no-interaction
```

2. Start services:
Expand Down
4 changes: 3 additions & 1 deletion api.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ LABEL description="Portfolio Analytics API"

# Install dependencies
COPY pyproject.toml ./pyproject.toml
RUN poetry install --only main,api
RUN pip install --no-cache-dir poetry==1.8.5 && \
poetry config virtualenvs.create false && \
poetry install --no-interaction --no-ansi --only main,api

# Copy source code to the container
COPY portfolio_analytics/common portfolio_analytics/common
Expand Down
4 changes: 0 additions & 4 deletions base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,3 @@ RUN groupadd -g 1000 appgroup && \
useradd -u 1000 -g appgroup -s /bin/bash -m appuser

WORKDIR /app

# Install poetry
RUN python3.12 -m pip install poetry==1.8.5 && \
poetry config virtualenvs.create false
4 changes: 3 additions & 1 deletion dashboard.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ LABEL description="Portfolio Analytics Dashboard"

# Install dependencies
COPY pyproject.toml ./pyproject.toml
RUN poetry install --only main,dashboard
RUN pip install --no-cache-dir poetry==1.8.5 && \
poetry config virtualenvs.create false && \
poetry install --no-interaction --no-ansi --only main,dashboard

# Copy source code to the container
COPY portfolio_analytics/common portfolio_analytics/common
Expand Down
5 changes: 0 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
volumes:
shared-data:
driver: local
# driver_opts:
# type: none
# o: bind
# device: ${PWD}/data
# name: portfolio-analytics-data

services:
data:
Expand Down
128 changes: 64 additions & 64 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ packages = [{ include = "portfolio_analytics" }]

[tool.poetry.dependencies]
python = ">=3.12,<3.13"
numpy = "^2.1.3"
numpy = "2.2.0"
openpyxl = "^3.1.5"
pandas = "^2.2.3"
pyarrow = "^18.1.0"
Expand Down
20 changes: 11 additions & 9 deletions deploy.sh → run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,23 @@ echo "Deploying application version ${GIT_TAG:-latest}"
docker run -d \
--name data \
--user 1000:1000 \
-v shared-data:/data \
-v shared-data:/data:rw \
ghcr.io/gbourniq/portfolio_analytics/data:${GIT_TAG:-latest}

# Dashboard service
docker run -d \
--name api \
--name dashboard \
--user 1000:1000 \
-v shared-data:/app/data \
-p 8000:8000 \
ghcr.io/gbourniq/portfolio_analytics/api:${GIT_TAG:-latest}
--group-add 1000 \
-p 8050:8050 \
-v shared-data:/app/data:rw \
ghcr.io/gbourniq/portfolio_analytics/dashboard:${GIT_TAG:-latest}

# API service
docker run -d \
--name dashboard \
--name api \
--user 1000:1000 \
-v shared-data:/app/data \
-p 8050:8050 \
ghcr.io/gbourniq/portfolio_analytics/dashboard:${GIT_TAG:-latest}
--group-add 1000 \
-p 8000:8000 \
-v shared-data:/app/data:rw \
ghcr.io/gbourniq/portfolio_analytics/api:${GIT_TAG:-latest}
Loading