Skip to content

Commit

Permalink
重构github提交历史
Browse files Browse the repository at this point in the history
  • Loading branch information
LoveU3th committed May 23, 2024
1 parent 4075c55 commit 440c0fa
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 18 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/Build and Push Docker Image.yml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
19 changes: 8 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 440c0fa

Please sign in to comment.