Skip to content

Commit

Permalink
adds better cache behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
StealWonders committed Mar 4, 2024
1 parent 08ea479 commit cb83757
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM golang:1.22-alpine as base

# Install git for VCS build information
RUN apk add --no-cache git

# Create another stage called "dev" that is based off of our "base" stage (so we have golang available to us)
FROM base as dev

Expand All @@ -15,9 +18,13 @@ CMD ["air"]
FROM base as built

WORKDIR /go/app/mensatt
COPY . .

# Install required dependencies here for better cache utilization
COPY go.mod go.sum ./
RUN go mod download

# Copy the rest of the code and build the binary
COPY . .
RUN go build -o /tmp/mensatt ./cmd/mensatt/main.go

FROM alpine:3.19 as prod
Expand Down

0 comments on commit cb83757

Please sign in to comment.