You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.5 KiB

4 years ago
  1. #
  2. # Copyright (C) 2019 Josh Habdas <jhabdas@protonmail.com>
  3. #
  4. # This file is part of After Dark.
  5. #
  6. # After Dark is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU Affero General Public License as published
  8. # by the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # After Dark is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU Affero General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU Affero General Public License
  17. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. #
  19. # DOCKER-VERSION 19.03.5, build 633a0ea
  20. # Specify build image
  21. ARG GO_VERSION=1.13.4
  22. ARG BUILD_TARGET=alpine3.10
  23. # Pull builder base image
  24. FROM golang:${GO_VERSION}-${BUILD_TARGET} AS hugobuilder
  25. # Set environment variables
  26. ENV HUGO_VERSION=0.61.0 \
  27. CGO_ENABLED=1 \
  28. GOOS=linux \
  29. GO111MODULE=on \
  30. BUILD_TAGS="extended"
  31. # Build from source using specified version
  32. RUN \
  33. apk add --update --no-cache git gcc g++ && \
  34. git clone https://github.com/gohugoio/hugo.git $GOPATH/src/github.com/gohugoio/hugo && \
  35. cd ${GOPATH:-$HOME/go}/src/github.com/gohugoio/hugo && \
  36. git checkout v$HUGO_VERSION && \
  37. go install -ldflags '-s -w -extldflags "-static"' -tags ${BUILD_TAGS}
  38. # Move compiled binary into own container
  39. FROM scratch
  40. COPY --from=hugobuilder /go/bin/hugo /hugo
  41. ENTRYPOINT ["/hugo"]
  42. CMD ["--help"]