Update Dockerfile
This commit is contained in:
+4
-8
@@ -6,16 +6,12 @@ WORKDIR /app
|
|||||||
# Install build dependencies
|
# Install build dependencies
|
||||||
RUN apk add --no-cache git ca-certificates
|
RUN apk add --no-cache git ca-certificates
|
||||||
|
|
||||||
# Copy go mod files safely handling missing or mismatched sum files
|
# Copy all files first so Go has full package context
|
||||||
COPY go.mod ./
|
|
||||||
COPY go.sum* ./
|
|
||||||
|
|
||||||
# Automatically tidy modules and download dependencies to prevent checksum errors
|
|
||||||
RUN go mod tidy && go mod download
|
|
||||||
|
|
||||||
# Copy source code
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
# Tidy and download dependencies with full visibility to resolve any checksum discrepancies
|
||||||
|
RUN go mod tidy && go mod download
|
||||||
|
|
||||||
# Build the application
|
# Build the application
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o blogging-cms .
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o blogging-cms .
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user