Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel #23

Merged
merged 8 commits into from
Aug 16, 2024
Merged
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
Loading