added dockerfile and other stuff

This commit is contained in:
Simon Martens
2024-12-08 20:39:55 +01:00
parent 6174dd6447
commit bd93e182bb
4 changed files with 16 additions and 18 deletions

View File

@@ -35,7 +35,8 @@ type KGPZ struct {
func (k *KGPZ) Init() {
if k.Config.Debug {
// NOTE: validity checks for poor people, speeding up dev mode:
// NOTE: validity checks done wrong, but speeding up dev mode:
// In dev mode we expect the folder to be a valid repository
if _, err := os.Stat(k.Config.FolderPath); err != nil {
k.initRepo()
} else {
@@ -171,8 +172,11 @@ func (k *KGPZ) Pull() {
func (k *KGPZ) initRepo() {
gp, err := providers.NewGitProvider(k.Config.Config.GitURL, k.Config.Config.FolderPath, k.Config.Config.GitBranch)
// TODO: what to do if the repo can't be initialized?
// What to do if the data can't be read?
// Handle in Serialize --> it musttry to initialize the repository if files are missing.
if err != nil {
logging.ObjErr(&gp, err, "Error creating GitProvider")
logging.Error(err, "Error initializing GitProvider")
return
}

View File

@@ -3,6 +3,6 @@
"git_branch": "main",
"webhook_endpoint": "/webhook",
"webhook_secret": "secret",
"debug": true,
"debug": false,
"watch": true
}

View File

@@ -1,12 +1,12 @@
name: kgpz_web
name: kgpz
services:
kgpz_web:
web:
build: .
volumes:
- kgpz_xml_data:/app/data_git
- kgpz_data:/app/data_git
ports:
- "8000:8080"
volumes:
kgpz_xml_data:
kgpz_data:
external: true

View File

@@ -1,22 +1,16 @@
FROM node:lts-alpine
COPY . /source
RUN apk add --no-cache \
unzip \
ca-certificates \
build-base
ADD https://go.dev/dl/go1.23.2.linux-amd64.tar.gz /tmp/go.tar.gz
RUN tar -C /usr/local -xzf /tmp/go.tar.gz
RUN export PATH=$PATH:/usr/local/go/bin
WORKDIR /source
RUN rm -rf ./data_git/
RUN rm -rf ./cache_gnd/
RUN npm --prefix ./views install
RUN npm --prefix ./views run build -- --config vite.config.js
RUN /usr/local/go/bin/go build -o /app/kgpz .
FROM golang:1.23
COPY --from=0 /source /source
WORKDIR /source
RUN go build -o /app/kgpz .
COPY ./config.dev.json /app/config.dev.json
WORKDIR /app