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
4 changed files with 7 additions and 9 deletions

View File

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

View File

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

View File

@ -18,7 +18,7 @@ RUN make VISE_PATH=/build/go-vise -B
WORKDIR /build
RUN echo "Building on $BUILDPLATFORM, building for $TARGETPLATFORM"
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
@ -33,8 +33,7 @@ COPY --from=build /build/ussd-africastalking .
COPY --from=build /build/LICENSE .
COPY --from=build /build/README.md .
COPY --from=build /build/services ./services
COPY --from=build /build/.env.example .
RUN mv .env.example .env
COPY --from=build /build/.env .
EXPOSE 7123

View File

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