diff --git a/Dockerfile b/Dockerfile index ed24874..f53cc3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ # Stage 1: Build the Go app FROM golang:1.22 AS builder -# Set the Current Working Directory inside the container WORKDIR /app # Copy go mod and sum files COPY go.mod go.sum ./ @@ -8,6 +7,8 @@ COPY go.mod go.sum ./ RUN go mod download # Copy the source from the current directory to the Working Directory inside the container COPY . . +# Change to the directory where the main.go file is located +WORKDIR /app/cmd/movie-api # Build the Go app RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main . @@ -16,7 +17,7 @@ FROM alpine:latest RUN apk --no-cache add ca-certificates WORKDIR /root/ # Copy the Pre-built binary file from the previous stage -COPY --from=builder /app/main . +COPY --from=builder /app/cmd/movie-api/main . # Expose port 9000 to the outside world EXPOSE 9000 # Command to run the executable