Add docker support

This commit is contained in:
yoan 2024-08-27 22:09:55 +08:00
parent 9bc83b2370
commit f3c84489e9
6 changed files with 52 additions and 0 deletions

31
.github/workflows/push_image.yml vendored Normal file
View File

@ -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

2
.gitignore vendored
View File

@ -15,3 +15,5 @@ build
*.njsproj
*.sln
*.sw?
dist/

9
Dockerfile Normal file
View File

@ -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"]

BIN
docker/data/data.db Normal file

Binary file not shown.

BIN
docker/data/logs.db Normal file

Binary file not shown.

10
docker/docker-compose.yml Normal file
View File

@ -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