Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
fix build injection
Browse files Browse the repository at this point in the history
  • Loading branch information
hay-kot committed Oct 14, 2022
1 parent 84bf670 commit 1279028
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/partial-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
--tag ghcr.io/hay-kot/homebox:nightly \
--tag ghcr.io/hay-kot/homebox:latest \
--tag ghcr.io/hay-kot/homebox:${{ inputs.tag }} \
--build-arg VERSION=${{ inputs.tag }} \
--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 .
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN pnpm build
FROM golang:alpine AS builder
ARG BUILD_TIME
ARG COMMIT
ARG VERSION
RUN apk update && \
apk upgrade && \
apk add --update git build-base gcc g++
Expand All @@ -22,7 +23,7 @@ RUN go get -d -v ./...
RUN rm -rf ./app/api/public
COPY --from=frontend-builder /app/.output/public ./app/api/public
RUN CGO_ENABLED=1 GOOS=linux go build \
-ldflags "-s -w -X main.Commit=$COMMIT -X main.BuildTime=$BUILD_TIME" \
-ldflags "-s -w -X main.commit=$COMMIT -X main.buildTime=$BUILD_TIME -X main.version=$VERSION" \
-o /go/bin/api \
-v ./app/api/*.go

Expand Down
6 changes: 3 additions & 3 deletions backend/app/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
)

var (
Version = "0.1.0"
Commit = "HEAD"
BuildTime = "now"
version = "nightly"
commit = "HEAD"
buildTime = "now"
)

// @title Go API Templates
Expand Down
6 changes: 3 additions & 3 deletions backend/app/api/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ func (a *app) newRouter(repos *repo.AllRepos) *chi.Mux {
v1.WithDemoStatus(a.conf.Demo), // Disable Password Change in Demo Mode
)
r.Get(v1Base("/status"), v1Ctrl.HandleBase(func() bool { return true }, v1.Build{
Version: Version,
Commit: Commit,
BuildTime: BuildTime,
Version: version,
Commit: commit,
BuildTime: buildTime,
}))

r.Post(v1Base("/users/register"), v1Ctrl.HandleUserRegistration())
Expand Down

0 comments on commit 1279028

Please sign in to comment.