Dockerfile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. ARG BASE_IMAGE=ghcr.io/imgproxy/imgproxy-base:latest
  2. # Git build stage
  3. FROM ${BASE_IMAGE} AS build
  4. ARG LYCHEE_VERSION="0.19.1"
  5. ARG GIT_VERSION="2.49.1"
  6. # lsb-release and gnupg are needed for the LLVM repository
  7. # TCL and gettext are needed for git
  8. RUN apt-get install -y lsb-release tcl gettext autoconf libz-dev libcurl4-openssl-dev
  9. # Install updated git
  10. RUN curl -O https://www.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz && \
  11. tar -zxf git-${GIT_VERSION}.tar.gz && \
  12. cd git-${GIT_VERSION} && \
  13. make configure && \
  14. ./configure prefix=/usr/git && \
  15. make all && \
  16. make install && \
  17. rm -rf git-${GIT_VERSION}
  18. # Get lychee binary
  19. RUN curl -L "https://github.com/lycheeverse/lychee/releases/download/lychee-v${LYCHEE_VERSION}/lychee-$(uname -m)-unknown-linux-gnu.tar.gz" | \
  20. tar -zxf -
  21. # Development container
  22. FROM ${BASE_IMAGE}
  23. ENV GOPATH=$HOME/go
  24. ENV PATH=$PATH:$GOROOT/bin:$GOPATH/bin
  25. # gnupg is requiered for clang-format
  26. RUN apt-get install -y gnupg lsb-release ssh
  27. # Install air
  28. RUN go install github.com/air-verse/air@latest
  29. # Install lefthook
  30. RUN go install github.com/evilmartians/lefthook@latest
  31. # Install gotestsum
  32. RUN go install gotest.tools/gotestsum@latest
  33. # Install golangci-lint
  34. RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.1.6
  35. # Copy git from the git build stage
  36. COPY --from=build /usr/git /usr
  37. # Add the LLVM GPG key
  38. RUN curl https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /usr/share/keyrings/llvm.gpg
  39. # Add the LLVM 20 APT repo
  40. RUN echo "deb [signed-by=/usr/share/keyrings/llvm.gpg] https://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-20 main" \
  41. | tee /etc/apt/sources.list.d/llvm.list
  42. # Install clang-format-20
  43. RUN apt-get -y update && apt-get -y install clang-format-20
  44. # Use clang-format-20 as the default clang-format
  45. RUN ln -sf /usr/bin/clang-format-20 /usr/local/bin/clang-format
  46. # Copy the lychee binary from the git build stage
  47. COPY --from=build /app/lychee /usr/bin