How to check the operation of containers during development?

I was developing a Go application and wanted to launch a container to check its operation up to the point where development was complete.
However, the go build fails because the developed code is not reflected in the main branch.
However, I cannot merge the code that has not been tested into the main branch.
I would appreciate if you could tell me the best practice in this case.
Here is my Dockerfile.

Translated with DeepL Translate: The world's most accurate translator (free version)

FROM golang:1.18 as builder

WORKDIR /go/src

COPY go.mod go.sum ./
RUN go mod download

COPY main.go ./

ARG CGO_ENABLED=0
ARG GOOS=linux
ARG GOARCH=amd64
RUN go build \
    -o /go/bin/main \
    -ldflags '-s -w'

FROM scratch as runner

COPY --from=builder /go/bin/main /app/main

ENTRYPOINT ["/app/main"]

Hello there. It depends how you build your image. Is it inside a CI or locally? Can you provide more details?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.