A continuation of HomeBox the inventory and organization system built for the Home User
setup docker volumes & versions
Hayden1dc9d6396a5a
diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yamlindex 253327f3..57f87c8b 100644--- a/.github/workflows/publish.yaml+++ b/.github/workflows/publish.yaml@@ -64,6 +64,7 @@ jobs:docker build --push \--tag ghcr.io/hay-kot/homebox:nightly \--build-arg COMMIT=$(git rev-parse HEAD) \+ --build-arg BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \--platform linux/amd64,linux/arm64,linux/arm/v7 .deploy-docs:diff --git a/Dockerfile b/Dockerfileindex fa6e5fd3..6aff8580 100644--- a/Dockerfile+++ b/Dockerfile@@ -1,3 +1,4 @@+# Build NuxtFROM node:17-alpine as frontend-builderWORKDIR /app@@ -6,27 +7,31 @@ COPY frontend/package.json frontend/pnpm-lock.yaml ./RUN pnpm install --frozen-lockfile --shamefully-hoistCOPY frontend .RUN pnpm build-RUN ls -la /app/.output/+# Build APIFROM golang:alpine AS builder-RUN apk update-RUN apk upgrade-RUN apk add --update git build-base gcc g+++ARG BUILD_TIME+ARG COMMIT+RUN apk update && \+ apk upgrade && \+ apk add --update git build-base gcc g+++WORKDIR /go/src/appCOPY ./backend .RUN go get -d -v ./...RUN rm -rf ./app/api/publicCOPY --from=frontend-builder /app/.output/public ./app/api/publicRUN CGO_ENABLED=1 GOOS=linux go build \+ -ldflags "-s -w -X main.Commit=$COMMIT -X main.BuildTime=$BUILD_TIME" \-o /go/bin/api \- -v ./app/api/*.go \- -ldflags "-s -w -X main.Commit `git rev-parse HEAD` -X main.BuildTime `date -u +%Y-%m-%dT%H:%M:%SZ`"+ -v ./app/api/*.go# Production StageFROM alpine:latestRUN apk --no-cache add ca-certificates-COPY ./backend/config.template.yml /app/config.yml+COPY ./backend/config.template.yml /data/config.yml+RUN mkdir /appCOPY --from=builder /go/bin/api /appRUN chmod +x /app/api@@ -34,4 +39,7 @@ RUN chmod +x /app/apiLABEL Name=homebox Version=0.0.1EXPOSE 7745WORKDIR /app-CMD [ "./api" ]+VOLUME [ "/data" ]++ENTRYPOINT [ "/app/api" ]+CMD [ "/data/config.yml" ]\ No newline at end of filediff --git a/README.md b/README.mdindex d35dfeac..6802bdd5 100644--- a/README.md+++ b/README.md@@ -60,10 +60,10 @@- [ ] Contributors Guide- [x] Security Policy- [ ] Feature Request Template-- [ ] Embedded Version Info- - [ ] Version Number- - [ ] Git Has-- [ ] Setup Docker Volumes in Dockerfile+- [x] Embedded Version Info+ - [x] Version Number+ - [x] Git Hash+- [x] Setup Docker Volumes in Dockerfile## All Todo'sdiff --git a/Taskfile.yml b/Taskfile.ymlindex 722d6472..903fb2c4 100644--- a/Taskfile.yml+++ b/Taskfile.yml@@ -20,7 +20,7 @@ tasks:api:cmds:- task: generate- - cd backend && go run ./app/api/ {{.CLI_ARGS}}+ - cd backend && go run ./app/api/ {{.CLI_ARGS}} ./config.ymlsilent: falseapi:build:diff --git a/backend/app/api/main.go b/backend/app/api/main.goindex f4a8d1aa..b1b90eb7 100644--- a/backend/app/api/main.go+++ b/backend/app/api/main.go@@ -2,6 +2,7 @@ package mainimport ("context"+ "os""time""github.com/hay-kot/content/backend/app/api/docs"@@ -31,10 +32,16 @@ var (// @name Authorization// @description "Type 'Bearer TOKEN' to correctly set the API Key"func main() {+ path := ""+ if len(os.Args) > 1 {+ path = os.Args[1]+ }- cfgFile := "config.yml"+ if path == "" {+ log.Warn().Msg("No configuration detected, using defaults")+ }- cfg, err := config.NewConfig(cfgFile)+ cfg, err := config.NewConfig(path)if err != nil {panic(err)}diff --git a/backend/internal/types/about_types.go b/backend/internal/types/about_types.goindex 76c60bc2..f3d33e9f 100644--- a/backend/internal/types/about_types.go+++ b/backend/internal/types/about_types.go@@ -14,5 +14,5 @@ type ApiSummary struct {type Build struct {Version string `json:"version"`Commit string `json:"commit"`- BuildTime string `json:"build_time"`+ BuildTime string `json:"buildTime"`}diff --git a/docker-compose.yml b/docker-compose.ymlindex 61d20eac..a1108fc3 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -6,5 +6,8 @@ services:build:context: .dockerfile: ./Dockerfile+ args:+ - COMMIT=head+ - BUILD_TIME=0001-01-01T00:00:00Zports:- 3100:7745