Skip to content

Commit e4475bf

Browse files
committed
Initial commit
1 parent 30aeaa0 commit e4475bf

30 files changed

Lines changed: 7250 additions & 1 deletion

.dockerignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.git
2+
.github
3+
__pycache__/
4+
*.py[cod]
5+
*.egg-info/
6+
.pytest_cache/
7+
venv/
8+
.venv/
9+
env/
10+
11+
config.json
12+
data.db
13+
data.db-shm
14+
data.db-wal
15+
16+
outputs/
17+
logs/
18+
test_outputs/
19+
.browser_profile/
20+
.browser_pay_profile/
21+
.uc_profile/
22+
23+
*.log
24+
xray_client.json

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
GHCR_IMAGE=ghcr.io/wold9527/codex-selfcart:latest
2+
STREAMLIT_PORT=8503
3+
TZ=Asia/Shanghai

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
GHCR_IMAGE=ghcr.io/your-github-username/abcard-main:latest
2+
STREAMLIT_PORT=8503
3+
TZ=Asia/Shanghai

.github/workflows/publish-ghcr.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Publish Docker Image
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- "v*"
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}
14+
15+
jobs:
16+
build-and-push:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup QEMU
27+
uses: docker/setup-qemu-action@v3
28+
29+
- name: Setup Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Login to GHCR
33+
uses: docker/login-action@v3
34+
with:
35+
registry: ${{ env.REGISTRY }}
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Docker metadata
40+
id: meta
41+
uses: docker/metadata-action@v5
42+
with:
43+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+
tags: |
45+
type=ref,event=branch
46+
type=ref,event=tag
47+
type=sha
48+
type=raw,value=latest,enable={{is_default_branch}}
49+
50+
- name: Build and push
51+
uses: docker/build-push-action@v6
52+
with:
53+
context: .
54+
file: ./Dockerfile
55+
platforms: linux/amd64,linux/arm64
56+
push: true
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}

.gitignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# 内部文档 (不随源码发布)
2+
实现文档.md
3+
兑换码系统文档.md
4+
5+
# Python
6+
__pycache__/
7+
*.py[cod]
8+
*.egg-info/
9+
dist/
10+
build/
11+
.eggs/
12+
*.egg
13+
.pytest_cache/
14+
15+
# 虚拟环境
16+
venv/
17+
.venv/
18+
env/
19+
20+
# IDE
21+
.vscode/
22+
.idea/
23+
*.swp
24+
*.swo
25+
26+
# 测试输出 (包含敏感凭证)
27+
test_outputs/
28+
outputs/
29+
logs/
30+
*.log
31+
32+
# 配置 (包含密钥)
33+
config.json
34+
35+
# 数据库
36+
data.db
37+
data.db-wal
38+
data.db-shm
39+
40+
# 开发测试脚本 (包含硬编码凭证)
41+
dev_tests/
42+
43+
# 浏览器临时 profile
44+
.browser_profile/
45+
.browser_pay_profile/
46+
.uc_profile/
47+
48+
# OS
49+
.DS_Store
50+
Thumbs.db
51+
*:Zone.Identifier
52+
xray_client.json

.streamlit/config.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[theme]
2+
base = "dark"
3+
primaryColor = "#7c3aed"
4+
backgroundColor = "#0a0a0f"
5+
secondaryBackgroundColor = "#141420"
6+
textColor = "#e8e8ed"
7+
font = "sans serif"

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM python:3.11-slim
2+
3+
ENV PYTHONDONTWRITEBYTECODE=1 \
4+
PYTHONUNBUFFERED=1 \
5+
PIP_NO_CACHE_DIR=1 \
6+
PLAYWRIGHT_BROWSERS_PATH=/ms-playwright \
7+
DISPLAY=:99 \
8+
STREAMLIT_PORT=8503 \
9+
ABC_DB_PATH=/app/runtime/data.db
10+
11+
WORKDIR /app
12+
13+
RUN apt-get update && apt-get install -y --no-install-recommends \
14+
xvfb \
15+
ca-certificates \
16+
curl \
17+
dumb-init \
18+
fonts-liberation \
19+
&& rm -rf /var/lib/apt/lists/*
20+
21+
COPY requirements.txt /app/requirements.txt
22+
23+
RUN pip install --upgrade pip \
24+
&& pip install -r /app/requirements.txt \
25+
&& python -m playwright install --with-deps chromium
26+
27+
COPY . /app
28+
29+
RUN mkdir -p /app/runtime /app/test_outputs /app/logs /app/outputs \
30+
&& chmod +x /app/docker/entrypoint.sh
31+
32+
EXPOSE 8503
33+
34+
ENTRYPOINT ["dumb-init", "--", "/app/docker/entrypoint.sh"]

0 commit comments

Comments
 (0)