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.

37 lines
1.5 KiB

4 years ago
  1. +++
  2. title = "Extended Builds"
  3. description = "Build Hugo with Sass and Go CDK Deploy support."
  4. categories = ["core"]
  5. tags = ["docker", "container", "sass", "cloud", "ci"]
  6. features = ["code highlighter", "related content"]
  7. [[copyright]]
  8. owner = "Josh Habdas"
  9. date = "2019, 2020"
  10. license = "agpl-3.0-or-later"
  11. +++
  12. After Dark ships with the ability to build Hugo from tagged-version source. Supply a version tag and let Docker Machine build you a high-performance extended Hugo build with integrated Sass and Go CDK deployment support.
  13. To use install Docker then run the following command:
  14. ```sh
  15. cd after-dark/docker/hugo && docker build .
  16. ```
  17. Build container uses Alpine and includes `musl-dev` for high-performance. Update the `HUGO_VERSION` to get a specific Hugo release built. Upon successful build extract the resulting `hugo` binary out of the scratch container like:
  18. ```sh
  19. docker create -it --name temp f2b785583ce8 sh && \
  20. sudo docker cp temp:/usr/local/bin/hugo /usr/local/bin && \
  21. docker rm -fv temp
  22. ```
  23. Where `f2b785583ce8` is the scratch container's Image ID and `/usr/local/bin` is the destination on the host. Place executable in most appropriate directory.
  24. For builds without Sass support enabled turn off `CGO_ENABLED`, pass in a phony value to `BUILD_TAGS`, create another build and give it a docker tag:
  25. ```sh
  26. docker tag $(docker images -q | head -n 1) gohugoio/hugo:v0.61.0
  27. ```
  28. It's recommended at least 2GB of storage space is available when running builds. The resulting binary inside the scratch container is less than 50MB.