2020-04-10 23:56:57 +00:00
|
|
|
# STEP 1: Build the website's files
|
2020-05-21 02:42:35 +00:00
|
|
|
FROM alpine:latest AS build-website
|
2020-04-10 23:56:57 +00:00
|
|
|
|
|
|
|
WORKDIR /src
|
|
|
|
|
|
|
|
COPY . /src/
|
|
|
|
|
2020-05-21 02:42:35 +00:00
|
|
|
# Get hugo -- using the edge branch to get latest version
|
|
|
|
RUN sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories
|
|
|
|
RUN apk update && apk upgrade && \
|
2020-05-28 04:21:02 +00:00
|
|
|
apk add --no-cache hugo=0.71.1-r0
|
2020-04-10 23:56:57 +00:00
|
|
|
|
|
|
|
RUN hugo --minify
|
|
|
|
|
2020-05-21 02:42:35 +00:00
|
|
|
# STEP 2: Build the static-web-server
|
2020-04-10 23:56:57 +00:00
|
|
|
FROM golang:alpine AS build-webserver
|
|
|
|
|
|
|
|
RUN apk update && apk upgrade && \
|
|
|
|
apk add --no-cache git
|
|
|
|
|
|
|
|
RUN go get -u git.simplesystems.tech/SimpleSystems/static-web-server
|
|
|
|
|
|
|
|
# STEP 3: Combine static files and binary on fresh alpine image
|
|
|
|
FROM alpine:latest
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Copy over static website files
|
|
|
|
COPY --from=build-website /src/public /app/public
|
|
|
|
|
|
|
|
# Copy over static-web-server
|
|
|
|
COPY --from=build-webserver /go/bin/static-web-server /app/
|
|
|
|
|
|
|
|
ENTRYPOINT ["./static-web-server", "-rootDir", "public", "-port", "80", "-redirect"]
|