Skip to content

Commit

Permalink
Add docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
usual2970 committed Aug 27, 2024
1 parent 9bc83b2 commit f3c8448
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/push_image.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ build
*.njsproj
*.sln
*.sw?

dist/
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
Binary file added docker/data/data.db
Binary file not shown.
Binary file added docker/data/logs.db
Binary file not shown.
10 changes: 10 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f3c8448

Please sign in to comment.