Fix Dockerfile: vendor dependencies after copying source
This commit is contained in:
parent
8e79b8c074
commit
0ae89c33db
12
Dockerfile
12
Dockerfile
@ -10,16 +10,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
# Copy go.mod and go.sum first for better layer caching
|
# Copy everything
|
||||||
COPY go.mod go.sum ./
|
|
||||||
|
|
||||||
# Download and vendor dependencies
|
|
||||||
RUN go mod download
|
|
||||||
RUN go mod vendor
|
|
||||||
|
|
||||||
# Copy source code
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
# Vendor dependencies (must be after copying source)
|
||||||
|
RUN go mod download && go mod vendor
|
||||||
|
|
||||||
# Build the binary with CGO enabled (required for sqlite3)
|
# Build the binary with CGO enabled (required for sqlite3)
|
||||||
RUN CGO_ENABLED=1 GOOS=linux go build -o /routewatch ./cmd/routewatch
|
RUN CGO_ENABLED=1 GOOS=linux go build -o /routewatch ./cmd/routewatch
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user