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.

56 lines
1.9 KiB

4 years ago
  1. #
  2. # Copyright (C) 2019, 2020 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.8-ce, build afacb8b7f0
  20. # Specify build image
  21. ARG GO_VERSION=1.14.3
  22. ARG BUILD_TARGET=alpine3.11
  23. # Pull builder base image
  24. FROM golang:${GO_VERSION}-${BUILD_TARGET} AS hugobuilder
  25. # Set hugo environment variables
  26. ENV HUGO_VERSION=0.71.0 \
  27. CGO_ENABLED=1 \
  28. GOOS=linux \
  29. GO111MODULE=on \
  30. BUILD_TAGS="extended"
  31. # Build hugo 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. # Install After Dark via script
  39. FROM node:alpine as sitebuilder
  40. COPY --from=hugobuilder /go/bin/hugo /usr/local/bin/hugo
  41. WORKDIR /tmp
  42. RUN wget -qO - https://go.habd.as/after-dark | sh
  43. # Move compiled sources into micro container
  44. FROM busybox
  45. EXPOSE 80
  46. COPY --from=hugobuilder /go/bin/hugo /usr/local/bin/hugo
  47. COPY --from=sitebuilder /tmp/flying-toasters/ /opt/after-dark/
  48. ENTRYPOINT ["/usr/local/bin/hugo"]
  49. CMD ["serve","--buildDrafts","--bind","0.0.0.0","--port","80","--source","/opt/after-dark","--destination","/var/www"]