Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5df1e9485a | |||
| d0af018510 | |||
| 7d938d0c26 | |||
| 82edcc51a7 |
@@ -12,5 +12,8 @@ jobs:
|
||||
with:
|
||||
go-version: '>=1.24'
|
||||
|
||||
- name: Build
|
||||
run: go build .
|
||||
|
||||
- name: Test
|
||||
run: go test . -v
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Build
|
||||
name: Deploy
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
|
||||
13
Dockerfile
Normal file
13
Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
||||
FROM golang:1.24.1-alpine3.21
|
||||
|
||||
WORKDIR /app
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY migrations ./migrations
|
||||
COPY static ./static
|
||||
COPY templates ./templates
|
||||
COPY *.go ./
|
||||
RUN go build -o /pcinv
|
||||
|
||||
CMD ["/pcinv"]
|
||||
10
main.go
10
main.go
@@ -5,6 +5,7 @@ import (
|
||||
"html/template"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"gitea.seeseepuff.be/seeseemelk/mysqlite"
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -18,7 +19,14 @@ var templateFS embed.FS
|
||||
|
||||
func main() {
|
||||
log.Println("Starting...")
|
||||
db, err := mysqlite.OpenDb("pcinv.db3")
|
||||
|
||||
// Get database path from environment variable or use default
|
||||
dbPath := os.Getenv("PCINV_DB")
|
||||
if dbPath == "" {
|
||||
dbPath = "pcinv.db3"
|
||||
}
|
||||
|
||||
db, err := mysqlite.OpenDb(dbPath)
|
||||
if err != nil {
|
||||
log.Fatalf("error opening db: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user