Browse Source

Initial image commit

master
Drew Short 4 years ago
parent
commit
cb6e4b979c
  1. 34
      Dockerfile
  2. 31
      pipeline.yml
  3. 31
      run.sh
  4. 1
      tag
  5. 11
      upload_pipeline.sh

34
Dockerfile

@ -0,0 +1,34 @@
# Use Alpine Linux as our base image so that we minimize the overall size our final container, and minimize the surface area of packages that could be out of date.
FROM alpine:3.9@sha256:b3dbf31b77fd99d9c08f780ce6f5282aba076d70a513a8be859d8d3a4d0c92b8
LABEL description="Docker container for building static sites with the Hugo static site generator."
LABEL maintainer="Johannes Mitlmeier <dev.jojomi@yahoo.com>"
LABEL maintainer="Drew Short <warrick@sothr.com>"
# config
ARG HUGO_VERSION=0.61
ENV HUGO_TYPE=_extended
ENV HUGO_ID=hugo${HUGO_TYPE}_${HUGO_VERSION}
VOLUME /src
VOLUME /output
WORKDIR /src
CMD ["/run.sh"]
EXPOSE 1313
COPY ./run.sh /run.sh
ADD https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/${HUGO_ID}_Linux-64bit.tar.gz /tmp
RUN tar -xf /tmp/${HUGO_ID}_Linux-64bit.tar.gz -C /tmp \
&& mkdir -p /usr/local/sbin \
&& mv /tmp/hugo /usr/local/sbin/hugo \
&& rm -rf /tmp/${HUGO_ID}_linux_amd64 \
&& rm -rf /tmp/${HUGO_ID}_Linux-64bit.tar.gz \
&& rm -rf /tmp/LICENSE.md \
&& rm -rf /tmp/README.md
RUN apk add --update git asciidoctor libc6-compat libstdc++ tar \
&& apk upgrade \
&& apk add --no-cache ca-certificates \
&& chmod 0777 /run.sh

31
pipeline.yml

@ -0,0 +1,31 @@
---
resources:
- name: git-resource
type: git
icon: git
source:
uri: ssh://git@git.nulloctet.com:8437/docker/hugo.git
private_key: |
((pull_key))
ignore_paths:
- pipeline.yml
- upload_pipeline.sh
- README.md
- name: git-resource-image
type: docker-image
icon: docker
source:
repository: ((nexus_docker_write.host))/sothr/hugo
username: ((nexus_docker_write.username))
password: ((nexus_docker_write.password))
jobs:
- name: build-image
plan:
- get: git-resource
trigger: true
- put: git-resource-image
params:
build: git-resource
tag_file: git-resource/tag
tag_as_latest: true

31
run.sh

@ -0,0 +1,31 @@
#!/bin/sh
WATCH="${HUGO_WATCH:=false}"
SLEEP="${HUGO_REFRESH_TIME:=-1}"
HUGO_SOURCE="${HUGO_SOURCE:=/src}"
HUGO_DESTINATION="${HUGO_DESTINATION:=/output}"
echo "HUGO_WATCH:" $WATCH
echo "HUGO_REFRESH_TIME:" $HUGO_REFRESH_TIME
echo "HUGO_THEME:" $HUGO_THEME
echo "HUGO_BASEURL" $HUGO_BASEURL
echo "ARGS" $@
HUGO=/usr/local/sbin/hugo
echo "Hugo path: $HUGO"
while [ true ]
do
if [[ $HUGO_WATCH != 'false' ]]; then
echo "Watching..."
$HUGO server --watch --source "$HUGO_SOURCE" --theme "$HUGO_THEME" --destination "$HUGO_DESTINATION" --baseURL "$HUGO_BASEURL" --bind "0.0.0.0" "$@" || exit 1
else
echo "Building one time..."
$HUGO --source "$HUGO_SOURCE" --theme "$HUGO_THEME" --destination "$HUGO_DESTINATION" --baseURL "$HUGO_BASEURL" "$@" || exit 1
fi
if [[ $HUGO_REFRESH_TIME == -1 ]]; then
exit 0
fi
echo "Sleeping for $HUGO_REFRESH_TIME seconds..."
sleep $SLEEP
done

1
tag

@ -0,0 +1 @@
0.61

11
upload_pipeline.sh

@ -0,0 +1,11 @@
#!/usr/bin/env bash
TEAM=docker
PIPELINE=hugo
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
pushd "${DIR}"
fly -t ${TEAM} set-pipeline --pipeline ${PIPELINE} --config pipeline.yml
popd
Loading…
Cancel
Save