2024-09-06 01:02:25 -04:00
|
|
|
# Stage 1: Build the application
|
2024-09-06 20:56:06 -04:00
|
|
|
FROM alpine:latest AS builder
|
2024-06-30 21:41:41 -04:00
|
|
|
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
2024-09-06 20:56:06 -04:00
|
|
|
RUN apk --no-cache add curl jq
|
2024-06-30 21:41:41 -04:00
|
|
|
|
2024-09-06 20:56:06 -04:00
|
|
|
RUN latest_release=$(curl --silent "https://api.github.com/repos/donetick/donetick/releases/latest" | jq -r .tag_name) && \
|
2024-11-23 16:46:46 +00:00
|
|
|
set -ex; \
|
|
|
|
apkArch="$(apk --print-arch)"; \
|
|
|
|
case "$apkArch" in \
|
|
|
|
armhf) arch='armv6' ;; \
|
|
|
|
armv7) arch='armv7' ;; \
|
|
|
|
aarch64) arch='arm64' ;; \
|
|
|
|
x86_64) arch='x86_64' ;; \
|
|
|
|
*) echo >&2 "error: unsupported architecture: $apkArch"; exit 1 ;; \
|
|
|
|
esac; \
|
|
|
|
curl -fL "https://github.com/donetick/donetick/releases/download/${latest_release}/donetick_Linux_$arch.tar.gz" | tar -xz -C .
|
2024-09-06 01:02:25 -04:00
|
|
|
|
|
|
|
# Stage 2: Create a smaller runtime image
|
|
|
|
FROM alpine:latest
|
|
|
|
|
|
|
|
# Install necessary CA certificates
|
2024-09-06 19:29:09 -04:00
|
|
|
RUN apk --no-cache add ca-certificates libc6-compat
|
2024-09-06 01:02:25 -04:00
|
|
|
|
|
|
|
# Copy the binary and config folder from the builder stage
|
2024-09-06 20:56:06 -04:00
|
|
|
COPY --from=builder /usr/src/app/donetick /donetick
|
2024-09-06 01:02:25 -04:00
|
|
|
COPY --from=builder /usr/src/app/config /config
|
|
|
|
|
|
|
|
# Set environment variables
|
2024-09-05 22:42:25 -04:00
|
|
|
ENV DT_ENV="selfhosted"
|
2024-09-06 01:02:25 -04:00
|
|
|
|
|
|
|
# Expose the application port
|
|
|
|
EXPOSE 2021
|
|
|
|
|
|
|
|
# Command to run the application
|
2024-09-05 22:58:22 -04:00
|
|
|
CMD ["/donetick"]
|