Skip to content

Commit

Permalink
Updated Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronzi committed Jul 14, 2024
1 parent 618ec31 commit 75472ef
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# 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 ./
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
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 .

Expand All @@ -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
Expand Down

0 comments on commit 75472ef

Please sign in to comment.