Skip to content

Commit

Permalink
chore(build): add makefile, fix and publish docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
willejs committed Aug 20, 2024
1 parent b945ba2 commit f634111
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ COPY . .

# statically compile the go binary for the presumed target of amd64 linux
# whilst its larger, its more portable and will run in a scratch container
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o api-server ./cmd/api-server
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o api-server ./cmd/api

# hack to create the nobody user for the scratch container.
# hadolint ignore=DL3059
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: test build build-docker
test:
go test -v ./...

build:
go build cmd/api/main.go

build-docker:
docker build --platform linux/amd64 -t willejs/port-service:latest .
5 changes: 4 additions & 1 deletion internal/adapter/repository/memdb_repository_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package repository_test

import (
"log/slog"
"os"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -10,7 +12,8 @@ import (
)

func TestMemDBPortRepository_GetAllPorts(t *testing.T) {
db, err := memdb.NewMemDB()
logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
db, err := memdb.NewMemDB(logger)
assert.NoError(t, err)
// Create the repository
repo := repository.NewMemDBPortRepository(db)
Expand Down

0 comments on commit f634111

Please sign in to comment.