完善docker相关配置
This commit is contained in:
13
.dockerignore
Normal file
13
.dockerignore
Normal file
@@ -0,0 +1,13 @@
|
||||
node_modules/
|
||||
.next/
|
||||
out/
|
||||
target/
|
||||
src-tauri/target/
|
||||
.git/
|
||||
*.md
|
||||
LICENSE
|
||||
.github/
|
||||
docs/
|
||||
.vscode/
|
||||
.idea/
|
||||
*.log
|
||||
12
.github/workflows/release.yml
vendored
12
.github/workflows/release.yml
vendored
@@ -342,6 +342,9 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU (for multi-arch builds)
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
@@ -352,6 +355,12 @@ jobs:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Extract version from tag
|
||||
id: version
|
||||
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
||||
@@ -360,10 +369,13 @@ jobs:
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}
|
||||
ghcr.io/${{ github.repository }}:latest
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/codeg:${{ steps.version.outputs.version }}
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/codeg:latest
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
|
||||
10
Dockerfile
10
Dockerfile
@@ -4,14 +4,16 @@ RUN corepack enable
|
||||
WORKDIR /app
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
COPY . .
|
||||
COPY src/ ./src/
|
||||
COPY public/ ./public/
|
||||
COPY next.config.ts tsconfig.json postcss.config.mjs components.json ./
|
||||
RUN pnpm build
|
||||
|
||||
# Stage 2: Build Rust server binary
|
||||
FROM rust:1.82-bookworm AS backend
|
||||
WORKDIR /app
|
||||
COPY src-tauri/ ./src-tauri/
|
||||
FROM rust:slim-bookworm AS backend
|
||||
RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /app/src-tauri
|
||||
COPY src-tauri/ ./
|
||||
RUN cargo build --release --bin codeg-server --no-default-features
|
||||
|
||||
# Stage 3: Runtime
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
services:
|
||||
codeg:
|
||||
build: .
|
||||
# Or use a pre-built image:
|
||||
# image: xintaofei/codeg:latest
|
||||
ports:
|
||||
- "3080:3080"
|
||||
volumes:
|
||||
- codeg-data:/data
|
||||
# Mount your project directories (optional):
|
||||
# - /path/to/projects:/projects
|
||||
environment:
|
||||
- CODEG_TOKEN=${CODEG_TOKEN:-}
|
||||
- CODEG_PORT=3080
|
||||
- CODEG_HOST=0.0.0.0
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
codeg-data:
|
||||
|
||||
Reference in New Issue
Block a user