Reworked Makefile to use Docker images, updated README
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,3 @@
|
||||
archetypes/
|
||||
flymd*
|
||||
public/
|
||||
resources/
|
||||
|
||||
14
Makefile
14
Makefile
@@ -4,20 +4,26 @@
|
||||
# - path to web root (in /tmp directory)
|
||||
WEBSITE=bdebyl.net
|
||||
|
||||
DOCKER_IMAGE_NAME=bdebyl/hugo
|
||||
DOCKER_IMAGE_TAG=0.2
|
||||
DOCKER_IMAGE=$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
|
||||
|
||||
DOCKER_RUN=docker run --rm -v $(shell pwd):/src -p 127.0.0.1:1313:1313/tcp
|
||||
|
||||
# Look up CloudFront distribution ID based on website alias
|
||||
DISTRIBUTION_ID=$(shell aws cloudfront list-distributions \
|
||||
--query 'DistributionList.Items[].{id:Id,a:Aliases.Items}[?contains(a,`$(WEBSITE)`)].id' \
|
||||
--query 'DistributionList.Items[].(id:Id,a:Aliases.Items)[?contains(a,`$(WEBSITE)`)].id' \
|
||||
--output text)
|
||||
|
||||
build:
|
||||
hugo
|
||||
$(DOCKER_RUN) $(DOCKER_IMAGE)
|
||||
|
||||
run:
|
||||
hugo server
|
||||
$(DOCKER_RUN) $(DOCKER_IMAGE) server --bind=0.0.0.0
|
||||
|
||||
clean:
|
||||
@# Clean up existing generated site
|
||||
rm -rf public/
|
||||
rm -rf public/ resources/
|
||||
|
||||
deploy: clean build
|
||||
@# Upload files to S3
|
||||
|
||||
18
README.md
18
README.md
@@ -7,15 +7,25 @@ etc. The binary static content is all hosted on S3 (i.e. `.jpeg`, `.png`, etc.).
|
||||
It was setup using **Terraform**, or more
|
||||
specifically
|
||||
[alimac/terraform-s3 (from commit 4b32c8d)](https://github.com/alimac/terraform-s3/tree/4b32c8d336ffacc4318c065f8d135973210f535c) --
|
||||
big thank you to @alimac on GitHub for that!
|
||||
big thank you to [**@alimac**](https://github.com/alimac/) on GitHub for that!
|
||||
|
||||
|
||||
# Usage
|
||||
The Makefile is a simple wrapper for `hugo` and `aws s3`, but provides useful
|
||||
short commands to test the hugo site locally and deploy it to AWS.
|
||||
The Makefile is a simple wrapper for the `bdebyl/hugo` Docker image and `aws
|
||||
s3`, but provides useful short commands to test the hugo site locally and deploy
|
||||
it to AWS.
|
||||
|
||||
## Dependencies
|
||||
[Docker](https://docs.docker.com/install/) is required to run the make targets
|
||||
for hosting and generating the static Hugo site.
|
||||
|
||||
## Development
|
||||
Simply start the Hugo server:
|
||||
To build the static content _without_ running the Hugo server:
|
||||
```
|
||||
make build
|
||||
```
|
||||
|
||||
To start the Hugo server on `http://localhost:1313`:
|
||||
```
|
||||
make run
|
||||
```
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
FROM alpine:3.7
|
||||
MAINTAINER Bastian de Byl <bastiandebyl@gmail.com>
|
||||
|
||||
ENV HUGO_DIR /usr/local/hugo
|
||||
ENV HUGO_BIN_DIR /usr/local/bin
|
||||
ENV HUGO_RELEASE_VER 0.52
|
||||
|
||||
RUN mkdir ${HUGO_DIR}
|
||||
ADD https://github.com/gohugoio/hugo/releases/download/v${HUGO_RELEASE_VER}/hugo_${HUGO_RELEASE_VER}_Linux-64bit.tar.gz ${HUGO_DIR}
|
||||
RUN find ${HUGO_DIR} -name "hugo*.tar.gz" -exec tar xzvf {} -C ${HUGO_DIR} \; -exec rm -v {} \; \
|
||||
&& ln -s ${HUGO_DIR}/hugo ${HUGO_BIN_DIR}
|
||||
|
||||
VOLUME /src
|
||||
WORKDIR /src
|
||||
|
||||
EXPOSE 1313
|
||||
CMD hugo server --baseURL=http://localhost:1313 --bind=0.0.0.0
|
||||
Reference in New Issue
Block a user