Skip to content

Commit 871eeaf

Browse files
authored
Merge pull request #5 from import-ai/feature/docker_deploy
Add Dockerfile support
2 parents 49d1e17 + 3843a44 commit 871eeaf

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.gitignore

.github/workflows/ci.yaml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Registry push
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
tags:
8+
- "v*"
9+
10+
jobs:
11+
docker:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Docker meta
17+
id: meta
18+
uses: docker/metadata-action@v5
19+
with:
20+
images: |
21+
ghcr.io/import-ai/magic-box-wizard
22+
tags: |
23+
type=ref,event=branch
24+
type=ref,event=pr
25+
type=semver,pattern={{version}}
26+
type=semver,pattern={{major}}.{{minor}}
27+
28+
- name: Set up QEMU
29+
uses: docker/setup-qemu-action@v3
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
34+
- name: Login to ghcr.io Registry
35+
if: github.event_name != 'pull_request'
36+
uses: docker/login-action@v3
37+
with:
38+
registry: ghcr.io
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Build and push
43+
uses: docker/build-push-action@v6
44+
with:
45+
context: .
46+
push: ${{ github.event_name != 'pull_request' }}
47+
tags: ${{ steps.meta.outputs.tags }}
48+
labels: ${{ steps.meta.outputs.labels }}
49+
platforms: |
50+
linux/amd64
51+
linux/arm64

Dockerfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM python:3.12
2+
WORKDIR /app
3+
RUN python3 -m pip install --no-cache-dir poetry && poetry config virtualenvs.create false
4+
COPY pyproject.toml poetry.lock /app/
5+
RUN poetry install --no-interaction --no-root --no-directory --only main
6+
COPY ./ /app
7+
EXPOSE 8000
8+
ENTRYPOINT ["uvicorn", "wizard.api.server:app", "--host", "0.0.0.0", "--port", "8000"]
9+
HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD wget -q -O- http://127.0.0.1:8000/api/v1/health || exit 1

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ description = ""
55
authors = ["Lucien Shui <[email protected]>"]
66
license = "Apache License 2.0"
77
readme = "README.md"
8+
package-mode = false
89

910
[tool.poetry.dependencies]
1011
python = "^3.12"

0 commit comments

Comments
 (0)