Skip to content

Commit 246c722

Browse files
authored
Merge pull request #157 from ks6088ts-labs/copilot/fix-156
Add Docker multi-architecture support and fix Streamlit module imports
2 parents 986e07f + 8c1462e commit 246c722

File tree

6 files changed

+128
-2
lines changed

6 files changed

+128
-2
lines changed

.github/workflows/docker-release.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ on:
66
jobs:
77
release:
88
runs-on: "ubuntu-latest"
9-
timeout-minutes: 5
9+
timeout-minutes: 10
1010
steps:
1111
- name: Check out the repo
1212
uses: actions/checkout@v5
13+
- name: Set up Docker Buildx
14+
uses: docker/setup-buildx-action@v3
1315
- name: Log in to Docker Hub
1416
uses: docker/login-action@v3
1517
with:
@@ -32,6 +34,7 @@ jobs:
3234
uses: docker/build-push-action@v6
3335
with:
3436
context: .
37+
platforms: linux/amd64,linux/arm64
3538
push: true
3639
build-args: |
3740
GIT_REVISION=${{ github.sha }}

.github/workflows/ghcr-release.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ env:
88
jobs:
99
ghcr:
1010
runs-on: ubuntu-latest
11-
timeout-minutes: 5
11+
timeout-minutes: 10
1212
permissions:
1313
packages: write
1414
contents: read
1515
steps:
1616
- uses: actions/checkout@v5
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v3
1719
- uses: docker/login-action@v3
1820
with:
1921
registry: ghcr.io
@@ -43,5 +45,6 @@ jobs:
4345
with:
4446
push: true
4547
context: .
48+
platforms: linux/amd64,linux/arm64
4649
tags: ${{ steps.meta.outputs.tags }}
4750
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,7 @@ RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
3737
# Copy application code after dependencies are installed
3838
COPY . .
3939

40+
# Set PYTHONPATH to include the working directory for module imports
41+
ENV PYTHONPATH="${PYTHONPATH}:/app"
42+
4043
CMD ["python", "template_langgraph/core.py"]

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ docker-build: ## build Docker image
7676
docker-run: ## run Docker container
7777
docker run --rm $(DOCKER_REPO_NAME)/$(DOCKER_IMAGE_NAME):$(GIT_TAG) $(DOCKER_COMMAND)
7878

79+
.PHONY: docker-run-streamlit
80+
docker-run-streamlit: ## run Docker container with Streamlit app
81+
docker run --rm \
82+
-p 8501:8501 \
83+
-v $(PWD)/.env:/app/.env \
84+
$(DOCKER_REPO_NAME)/$(DOCKER_IMAGE_NAME):$(GIT_TAG) \
85+
streamlit run template_langgraph/services/streamlits/main.py --server.address 0.0.0.0
86+
7987
.PHONY: docker-lint
8088
docker-lint: ## lint Dockerfile
8189
docker run --rm -i hadolint/hadolint < Dockerfile

docs/index.ja.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,58 @@ Streamlit アプリのデモ:
240240

241241
[![streamlit.png](./images/streamlit.png)](https://youtu.be/undxBwyJ3Sc)
242242

243+
### オプション 6: Docker(本番デプロイ)
244+
245+
アプリケーションを Docker で実行すると、環境差による違いを減らし、一貫したデプロイが可能になります。ここではイメージのビルド、Streamlit のコンテナ実行、事前ビルド済みイメージの利用、マルチアーキテクチャ対応について説明します。
246+
247+
#### Docker イメージのビルド
248+
249+
```shell
250+
# ローカルで Docker イメージをビルド
251+
make docker-build
252+
253+
# または特定のタグでビルド
254+
docker build -t ks6088ts/template-langgraph:latest .
255+
```
256+
257+
#### Streamlit を Docker で実行
258+
259+
```shell
260+
# Docker で Streamlit アプリを実行する(Makefile ターゲット)
261+
make docker-run-streamlit
262+
263+
# または .env をコンテナにマウントして手動で実行
264+
docker run --rm \
265+
-p 8501:8501 \
266+
-v ./.env:/app/.env \
267+
ks6088ts/template-langgraph:latest \
268+
streamlit run template_langgraph/services/streamlits/main.py --server.address 0.0.0.0
269+
```
270+
271+
#### 事前ビルド済みイメージの使用
272+
273+
```shell
274+
# Docker Hub から実行
275+
docker run --rm \
276+
-p 8501:8501 \
277+
-v ./.env:/app/.env \
278+
ks6088ts/template-langgraph:latest \
279+
streamlit run template_langgraph/services/streamlits/main.py --server.address 0.0.0.0
280+
281+
# GitHub Container Registry から実行
282+
docker run --rm \
283+
-p 8501:8501 \
284+
-v ./.env:/app/.env \
285+
ghcr.io/ks6088ts-labs/template-langgraph:latest \
286+
streamlit run template_langgraph/services/streamlits/main.py --server.address 0.0.0.0
287+
```
288+
289+
#### マルチアーキテクチャ対応
290+
291+
このリポジトリの Docker イメージは `amd64``arm64` 両アーキテクチャ向けにビルドされています。これにより、Intel/AMD の x64 マシンや Apple Silicon(M1/M2/M3/M4)などの ARM 環境でも動作します。
292+
293+
コンテナを起動したら、ブラウザで [http://localhost:8501](http://localhost:8501) にアクセスして Streamlit アプリを確認できます。
294+
243295
### 追加の実行例
244296

245297
- Issue formatter(構造化出力):

docs/index.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,63 @@ Demonstration of the Streamlit app:
240240

241241
[![streamlit.png](./images/streamlit.png)](https://youtu.be/undxBwyJ3Sc)
242242

243+
### Option 6: Docker (Production deployment)
244+
245+
You can run the application in Docker for consistent deployment across environments:
246+
247+
#### Building the Docker Image
248+
249+
```shell
250+
# Build the Docker image locally
251+
make docker-build
252+
253+
# Or build with specific tag
254+
docker build -t ks6088ts/template-langgraph:latest .
255+
```
256+
257+
#### Running Streamlit in Docker
258+
259+
```shell
260+
# Run Streamlit app with Docker
261+
make docker-run-streamlit
262+
263+
# Or run manually with environment file
264+
docker run --rm \
265+
-p 8501:8501 \
266+
-v ./.env:/app/.env \
267+
ks6088ts/template-langgraph:latest \
268+
streamlit run template_langgraph/services/streamlits/main.py --server.address 0.0.0.0
269+
```
270+
271+
#### Using Pre-built Images
272+
273+
You can also use pre-built images from Docker Hub or GitHub Container Registry:
274+
275+
```shell
276+
# From Docker Hub
277+
docker run --rm \
278+
-p 8501:8501 \
279+
-v ./.env:/app/.env \
280+
ks6088ts/template-langgraph:latest \
281+
streamlit run template_langgraph/services/streamlits/main.py --server.address 0.0.0.0
282+
283+
# From GitHub Container Registry
284+
docker run --rm \
285+
-p 8501:8501 \
286+
-v ./.env:/app/.env \
287+
ghcr.io/ks6088ts-labs/template-langgraph:latest \
288+
streamlit run template_langgraph/services/streamlits/main.py --server.address 0.0.0.0
289+
```
290+
291+
#### Multi-Architecture Support
292+
293+
The Docker images are built for both `amd64` and `arm64` architectures, making them compatible with:
294+
- Intel/AMD x64 processors
295+
- Apple Silicon (M1/M2/M3/M4) processors
296+
- ARM-based servers
297+
298+
Access the Streamlit app at [http://localhost:8501](http://localhost:8501) after running the container.
299+
243300
### More agent runs
244301

245302
- Issue formatter (structured output):

0 commit comments

Comments
 (0)