Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5df1e9485a | |||
| d0af018510 | |||
| 7d938d0c26 | |||
| 82edcc51a7 |
@@ -12,5 +12,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: '>=1.24'
|
go-version: '>=1.24'
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: go build .
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: go test . -v
|
run: go test . -v
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Build
|
name: Deploy
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
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"
|
"html/template"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
|
|
||||||
"gitea.seeseepuff.be/seeseemelk/mysqlite"
|
"gitea.seeseepuff.be/seeseemelk/mysqlite"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -18,7 +19,14 @@ var templateFS embed.FS
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.Println("Starting...")
|
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 {
|
if err != nil {
|
||||||
log.Fatalf("error opening db: %v", err)
|
log.Fatalf("error opening db: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user