diff --git a/.github/workflows/Build and Push Docker Image.yml b/.github/workflows/Build and Push Docker Image.yml new file mode 100644 index 0000000..3c40077 --- /dev/null +++ b/.github/workflows/Build and Push Docker Image.yml @@ -0,0 +1,44 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - master # Replace with your branch name if different + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: cursor1st/override + tags: | + type=ref,event=tag + type=semver,pattern={{version}} + type=raw,value=latest + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index c92048b..667639b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,22 @@ FROM golang:alpine AS builder WORKDIR /app +COPY . . -ADD . . +ENV GO111MODULE=on +RUN go mod download -RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o override +RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o override FROM alpine:latest -COPY --from=builder /app/override /usr/local/bin/override +RUN apk --no-cache add ca-certificates -WORKDIR /app +COPY --from=builder /app/override /usr/local/bin/ +COPY config.json.example /app/config.json -ENTRYPOINT ["/usr/local/bin/override"] +WORKDIR /app +VOLUME /app -EXPOSE 8181 +EXPOSE 8080 +CMD ["override"] \ No newline at end of file diff --git a/README.md b/README.md index ee7f073..e5bd1a0 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ```json "github.copilot.advanced": { "debug.overrideProxyUrl": "http://127.0.0.1:8181", - "debug.chatOverrideProxyUrl": "http://127.0.0.1:8181/v1/chat/completions", + "debug.chatOverrideProxyUrl": "http://127.0.0.1:8181/v1/chat", "authProvider": "github-enterprise" }, "github-enterprise.uri": "https://cocopilot.org", diff --git a/docker-compose.yml b/docker-compose.yml index 296fe21..203b709 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,12 +1,9 @@ +name: override services: - override-app: - image: linux-do/override:latest - container_name: override-app - restart: always - build: - context: . - dockerfile: Dockerfile - volumes: - - ./config.json:/app/config.json - ports: - - "8181:8181" + override: + container_name: override + ports: + - 8080:8080 + volumes: + - /root/docker/override:/app + image: cursor1st/override:latest \ No newline at end of file