Skip to content

Commit

Permalink
add docker
Browse files Browse the repository at this point in the history
  • Loading branch information
zenuo committed Jul 18, 2024
1 parent c445a27 commit 4eac106
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci_server_and_web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,19 @@ jobs:
needs: [build-web]
if: ${{!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')}}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
container:
image: rust:alpine
volumes:
- ./gogo-server:/gogo-server
env:
RUST_TARGET: x86_64-unknown-linux-musl
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
steps:
- name: Clone repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -145,3 +152,29 @@ jobs:
name: server-web-${{ env.RUST_TARGET }}
path: package/
retention-days: 7
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile_workflow
push: true
tags: ${{ github.actor }}/${{ github.repository }}:latest
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
8 changes: 8 additions & 0 deletions Dockerfile_workflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM alpine:3.16
WORKDIR /opt/
RUN apk upgrade --no-cache && apk add --no-cache openssl libgcc
COPY package/gogo-server .
COPY package/config.json .
COPY package/gogo-web .
EXPOSE 4998
ENTRYPOINT ["/opt/gogo-server","config.json"]
3 changes: 1 addition & 2 deletions gogo-server/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"listen_address": "127.0.0.1:4998",
"listen_address": "0.0.0.0:4998",
"google_base_url": "https://google.com",
"static_path": "gogo-web/",
"http_client_pool_max_idle_per_host": 20,
Expand All @@ -15,6 +15,5 @@
"accept-language": "en-US,en;q=0.9",
"cache-control": "no-cache"
},
"proxy": "socks5://127.0.0.1:9050",
"suggest_user_agent": "Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36"
}

0 comments on commit 4eac106

Please sign in to comment.