diff --git a/.github/workflows/push_image.yml b/.github/workflows/push_image.yml new file mode 100644 index 00000000..c0330f21 --- /dev/null +++ b/.github/workflows/push_image.yml @@ -0,0 +1,31 @@ +name: Docker Image CI + +on: + push: + branches: ["main"] + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + + with: + registry: registry.cn-shanghai.aliyuncs.com + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: usual2970/certimate:latest diff --git a/.gitignore b/.gitignore index da0ee1a3..22802d77 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ build *.njsproj *.sln *.sw? + +dist/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..685a29ba --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM golang:1.22-alpine + +WORKDIR /app + +COPY ../. /app/ + +RUN go build -o certimate + +ENTRYPOINT ["./certimate", "serve", "--http", "0.0.0.0:8090"] \ No newline at end of file diff --git a/docker/data/data.db b/docker/data/data.db new file mode 100644 index 00000000..16093e14 Binary files /dev/null and b/docker/data/data.db differ diff --git a/docker/data/logs.db b/docker/data/logs.db new file mode 100644 index 00000000..3072fe53 Binary files /dev/null and b/docker/data/logs.db differ diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 00000000..514dcd47 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3.0' +services: + certimate: + image: registry.cn-shanghai.aliyuncs.com/usual2970/certimate:v0.0.4 + container_name: certimate + ports: + - 8090:8090 + volumes: + - ./data:/app/pb_data + restart: unless-stopped \ No newline at end of file