Compare commits

..

2 Commits

Author SHA1 Message Date
95f6a735a0
ifx: log line to display build version 2024-11-19 16:30:41 +03:00
0bb44fc80b
feat: dockerfile and github based CI build
* fixed missing error handler in main
* add injectable build string in main
* add (dynamically linked) docker build
* add github CI workflow
* add extra but useful dev files in dev folder
2024-11-19 13:50:36 +03:00
5 changed files with 9 additions and 11 deletions

View File

@ -10,4 +10,4 @@
!/LICENSE !/LICENSE
!/README.md !/README.md
!/go.* !/go.*
!/.env.example !/.env

View File

@ -45,7 +45,9 @@ jobs:
with: with:
context: ./ context: ./
file: ./Dockerfile file: ./Dockerfile
platforms: linux/amd64 platforms:
- linux/amd64
- linux/arm64
push: true push: true
build-args: | build-args: |
BUILD=${{ env.RELEASE_SHORT_COMMIT }} BUILD=${{ env.RELEASE_SHORT_COMMIT }}

View File

@ -18,7 +18,7 @@ RUN make VISE_PATH=/build/go-vise -B
WORKDIR /build WORKDIR /build
RUN echo "Building on $BUILDPLATFORM, building for $TARGETPLATFORM" RUN echo "Building on $BUILDPLATFORM, building for $TARGETPLATFORM"
RUN go mod download RUN go mod download
RUN go build -tags logtrace -o ussd-africastalking -ldflags="-X main.build=${BUILD} -s -w" cmd/africastalking/main.go RUN go build -o ussd-africastalking -ldflags="-X main.build=${BUILD} -s -w" cmd/africastalking/main.go
FROM debian:bookworm-slim FROM debian:bookworm-slim
@ -33,8 +33,7 @@ COPY --from=build /build/ussd-africastalking .
COPY --from=build /build/LICENSE . COPY --from=build /build/LICENSE .
COPY --from=build /build/README.md . COPY --from=build /build/README.md .
COPY --from=build /build/services ./services COPY --from=build /build/services ./services
COPY --from=build /build/.env.example . COPY --from=build /build/.env .
RUN mv .env.example .env
EXPOSE 7123 EXPOSE 7123

View File

@ -41,13 +41,10 @@ func buildConnStr() string {
dbName := initializers.GetEnv("DB_NAME", "") dbName := initializers.GetEnv("DB_NAME", "")
port := initializers.GetEnv("DB_PORT", "5432") port := initializers.GetEnv("DB_PORT", "5432")
connString := fmt.Sprintf( return fmt.Sprintf(
"postgres://%s:%s@%s:%s/%s", "postgres://%s:%s@%s:%s/%s",
user, password, host, port, dbName, user, password, host, port, dbName,
) )
logg.Debugf("pg conn string", "conn", connString)
return connString
} }
func NewMenuStorageService(dbDir string, resourceDir string) *MenuStorageService { func NewMenuStorageService(dbDir string, resourceDir string) *MenuStorageService {

View File

@ -2,8 +2,8 @@
package testtag package testtag
import "git.grassecon.net/urdt/ussd/remote" import "git.grassecon.net/urdt/ussd/internal/handlers/server"
var ( var (
AccountService remote.AccountServiceInterface AccountService server.AccountServiceInterface
) )