Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,31 @@ WORKDIR /app
COPY go.mod go.sum ./

# Download dependencies
RUN go mod download
# Retried: proxy.golang.org intermittently resets HTTP/2 streams mid-download.
# Only transport failures are worth retrying. If the proxy or VCS returned a
# definitive answer, or the error is in local files, another attempt cannot
# change it, so fail fast instead of sleeping through the backoff.
RUN --mount=type=cache,target=/go/pkg/mod \
for attempt in 1 2 3 4 5; do \
Comment thread
Astach marked this conversation as resolved.
if go mod download >/tmp/godl.log 2>&1; then exit 0; fi; \
cat /tmp/godl.log; \
if grep -qE 'SECURITY ERROR|checksum mismatch|missing go.sum entry|errors parsing go.mod|invalid version|unknown revision|malformed module path|module lookup disabled' /tmp/godl.log; then \
echo "go mod download failed with a non-transient error; not retrying"; \
exit 1; \
fi; \
echo "go mod download failed (attempt ${attempt}/5)"; \
[ "${attempt}" = 5 ] && break; \
sleep $((attempt * 5)); \
done; \
exit 1

# Copy the source code to the container's working directory
COPY . .

# Build the Go application
RUN go build -o qovery -ldflags "-X github.com/qovery/qovery-cli/utils.Version=$APP_VERSION"
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go build -o qovery -ldflags "-X github.com/qovery/qovery-cli/utils.Version=$APP_VERSION"

FROM public.ecr.aws/r3m4q3r9/pub-mirror-debian:bookworm-slim as runner

Expand Down
Loading