Skip to content

Commit

Permalink
dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
elnosh committed Nov 12, 2024
1 parent bf5101d commit e01274c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM golang:1.22.2-alpine AS builder

# for gcc
RUN apk add build-base

WORKDIR /app
COPY . /app

# need CGO for sqlite
RUN CGO_ENABLED=1 GOOS=linux go build -o main ./cmd/mint/mint.go

FROM alpine:latest AS final

COPY --from=builder /app .

EXPOSE 3338
CMD ["./main"]
7 changes: 6 additions & 1 deletion cmd/mint/mint.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ func configFromEnv() (*mint.Config, error) {
mintPath = filepath.Join(homedir, ".gonuts", "mint")
}

dbMigrations := os.Getenv("DB_MIGRATIONS")
if len(dbMigrations) == 0 {
dbMigrations = "../../mint/storage/sqlite/migrations"
}

mintLimits := mint.MintLimits{}
if maxBalanceEnv, ok := os.LookupEnv("MAX_BALANCE"); ok {
maxBalance, err := strconv.ParseUint(maxBalanceEnv, 10, 64)
Expand Down Expand Up @@ -161,7 +166,7 @@ func configFromEnv() (*mint.Config, error) {
DerivationPathIdx: uint32(derivationPathIdx),
Port: port,
MintPath: mintPath,
DBMigrationPath: "../../mint/storage/sqlite/migrations",
DBMigrationPath: dbMigrations,
InputFeePpk: inputFeePpk,
MintInfo: mintInfo,
Limits: mintLimits,
Expand Down
2 changes: 1 addition & 1 deletion mint/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (ms *MintServer) setupHttpServer(port string) error {
return errors.New("port cannot be empty")
}
server := &http.Server{
Addr: "127.0.0.1:" + port,
Addr: ":" + port,
Handler: r,
}

Expand Down

0 comments on commit e01274c

Please sign in to comment.