refactor: move app entrypoint to ./cmd/server
This commit is contained in:
parent
bb8e1aceb1
commit
63cc8628bc
3 changed files with 18 additions and 13 deletions
|
|
@ -8,7 +8,7 @@ RUN go mod download
|
|||
|
||||
COPY . .
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o backoffice-api .
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o server ./cmd/server
|
||||
|
||||
FROM alpine:3.19
|
||||
|
||||
|
|
@ -17,6 +17,6 @@ WORKDIR /app
|
|||
|
||||
RUN apk add --no-cache ca-certificates
|
||||
|
||||
COPY --from=builder /build/backoffice-api .
|
||||
COPY --from=builder /build/server .
|
||||
|
||||
CMD ["/app/backoffice-api"]
|
||||
CMD ["/app/server"]
|
||||
|
|
|
|||
15
cmd/server/main.go
Normal file
15
cmd/server/main.go
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.Println("Starting backoffice-api server...")
|
||||
log.Println("Simulating a running server...")
|
||||
// do nothing, simulate a running server
|
||||
for {
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
}
|
||||
10
main.go
10
main.go
|
|
@ -1,10 +0,0 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello from backoffice api")
|
||||
for {
|
||||
// do nothing, simulate a running server
|
||||
}
|
||||
}
|
||||
Reference in a new issue