Skip to content

Commit

Permalink
Merge pull request #23 from HilkopterBob/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
HilkopterBob authored Aug 16, 2024
2 parents 5c7f3a5 + 01140a9 commit 4077892
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 6 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/build-docker-container.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: ci
name: docker-build

on:
push:
branches: ["binary-release", "master", "devel"]
release:
types: [published]

jobs:
docker:
Expand All @@ -20,3 +20,5 @@ jobs:
with:
push: true
tags: hilkopterbob/packagelock:latest
build-args: |
APP_VERSION=${{ github.event.release.tag_name }}
21 changes: 21 additions & 0 deletions .github/workflows/unstable-build-docker-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: unstable-docker-build

on:
push:

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: hilkopterbob/packagelock:unstable-${{ github.head_ref || github.ref_name }}
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ RUN go mod download


# Build

RUN CGO_ENABLED=0 GOOS=linux go build -o /packagelock
ARG APP_VERSION="v0.1.0+hotfixes"
RUN \
CGO_ENABLED=0 GOOS=linux go build -ldflags "-X 'main.AppVersion=$APP_VERSION'" -o /packagelock

# Optional:
# To bind to a TCP port, runtime parameters must be supplied to the docker command.
Expand Down
1 change: 1 addition & 0 deletions config/conf-init.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type ConfigProvider interface {
ReadConfig(in io.Reader) error
AllSettings() map[string]any
GetString(string string) string
SetDefault(key string, value any)
}

// TODO: How to test?
Expand Down
10 changes: 9 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,20 @@ import (
"github.com/spf13/viper"
)

// Data structs
// Linker Injections
// Version injection with Docker Build & ldflags
// Do not modify, init or change in code!
var AppVersion string

// TODO: support for multiple network adapters.

func main() {
Config := config.StartViper(viper.New())

if AppVersion != "" {
Config.SetDefault("general.app-version", AppVersion)
}

fmt.Println(Config.AllSettings())

// Channel to signal the restart
Expand Down

0 comments on commit 4077892

Please sign in to comment.