aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Mo Tarbin <mhed.t91@gmail.com>2024-09-06 20:56:16 -0400
committerLibravatar Mo Tarbin <mhed.t91@gmail.com>2024-09-06 20:56:16 -0400
commitd50be55ae5094f56bb8533bb90d8d8e7ec858ce7 (patch)
treee0bf60f1277bcb449eab73b86812cabeab4e1a01
parent50553bcd65a01741a8c83c8db39229ed3f921d23 (diff)
parent3cad5f8d71c2b1f6c5c52b89580433fba9843267 (diff)
downloaddonetick-d50be55ae5094f56bb8533bb90d8d8e7ec858ce7.tar.gz
donetick-d50be55ae5094f56bb8533bb90d8d8e7ec858ce7.tar.bz2
donetick-d50be55ae5094f56bb8533bb90d8d8e7ec858ce7.zip
use the build binary instead of building from source again
Diffstat (limited to '')
-rw-r--r--Dockerfile11
1 files changed, 5 insertions, 6 deletions
diff --git a/Dockerfile b/Dockerfile
index 78924b5..529996f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,13 +1,12 @@
# Stage 1: Build the application
-FROM golang:1.22 AS builder
+FROM alpine:latest AS builder
WORKDIR /usr/src/app
-COPY go.mod go.sum ./
-RUN go mod download && go mod verify
+RUN apk --no-cache add curl jq
-COPY . .
-RUN CGO_ENABLED=1 GOOS=linux go build -ldflags="-s -w" -buildvcs=false -o /donetick
+RUN latest_release=$(curl --silent "https://api.github.com/repos/donetick/donetick/releases/latest" | jq -r .tag_name) && \
+curl -fL "https://github.com/donetick/donetick/releases/download/${latest_release}/donetick_Linux_x86_64.tar.gz" | tar -xz -C .
# Stage 2: Create a smaller runtime image
FROM alpine:latest
@@ -16,7 +15,7 @@ FROM alpine:latest
RUN apk --no-cache add ca-certificates libc6-compat
# Copy the binary and config folder from the builder stage
-COPY --from=builder /donetick /donetick
+COPY --from=builder /usr/src/app/donetick /donetick
COPY --from=builder /usr/src/app/config /config
# Set environment variables