Compare commits
No commits in common. "e6b4f34f0b7906ba0aad150354495eb522318ba7" and "6752b55a6bf5bb05130dc2d2a411d06284237290" have entirely different histories.
e6b4f34f0b
...
6752b55a6b
2 changed files with 20 additions and 30 deletions
48
Dockerfile
48
Dockerfile
|
|
@ -1,38 +1,24 @@
|
||||||
# Global build argument
|
# Global build argument
|
||||||
ARG THTTPD_VER=2.29
|
ARG THTTPD_VER=2.29
|
||||||
ARG DI_VER=1.2.5
|
|
||||||
|
|
||||||
FROM ubuntu:latest AS builder
|
FROM alpine:latest AS builder
|
||||||
|
|
||||||
|
|
||||||
# =====BUILD BINARIES=====
|
# =====BUILD thttpd=====
|
||||||
WORKDIR /usr/src
|
WORKDIR /usr/src
|
||||||
ARG THTTPD_VER
|
ARG THTTPD_VER
|
||||||
ARG DI_VER
|
|
||||||
|
|
||||||
# Install dependencies & build thttpd
|
# Install dependencies & build thttpd
|
||||||
RUN apt update && \
|
RUN apk update && \
|
||||||
apt install -y --no-install-recommends \
|
apk add --no-cache curl hugo build-base && \
|
||||||
curl \
|
|
||||||
ca-certificates \
|
|
||||||
hugo \
|
|
||||||
musl-dev \
|
|
||||||
musl-tools \
|
|
||||||
build-essential && \
|
|
||||||
curl -sSL "https://www.acme.com/software/thttpd/thttpd-$THTTPD_VER.tar.gz" | \
|
curl -sSL "https://www.acme.com/software/thttpd/thttpd-$THTTPD_VER.tar.gz" | \
|
||||||
tar xzf - && \
|
tar xzf - && \
|
||||||
cd "thttpd-$THTTPD_VER" && \
|
cd "thttpd-$THTTPD_VER" && \
|
||||||
CC="musl-gcc -static" ./configure && \
|
./configure && \
|
||||||
make -j$(nproc)
|
make
|
||||||
|
|
||||||
# Build dumb-init
|
|
||||||
RUN curl -sSL "https://github.com/Yelp/dumb-init/archive/refs/tags/v$DI_VER.tar.gz" | \
|
|
||||||
tar xzf - && \
|
|
||||||
cd "dumb-init-$DI_VER" && \
|
|
||||||
CC="musl-gcc -static" make build
|
|
||||||
|
|
||||||
|
|
||||||
# =====BUILD BLOG=====
|
# =====BUILD THE BLOG=====
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
# Copy site files for building
|
# Copy site files for building
|
||||||
|
|
@ -43,18 +29,22 @@ RUN hugo --minify
|
||||||
|
|
||||||
|
|
||||||
# ====CREATE RELEASE IMAGE====
|
# ====CREATE RELEASE IMAGE====
|
||||||
FROM scratch
|
FROM alpine:latest
|
||||||
ARG THTTPD_VER
|
ARG THTTPD_VER
|
||||||
ARG DI_VER
|
|
||||||
|
# Install dumb-init & create a non-root user
|
||||||
|
RUN apk update && \
|
||||||
|
apk add --no-cache dumb-init && \
|
||||||
|
addgroup -g 82 -S www-data && \
|
||||||
|
adduser -u 82 -D -S -G www-data www-data
|
||||||
|
|
||||||
# Copy over binary & static files
|
# Copy over binary & static files
|
||||||
COPY --from=builder /usr/src/thttpd-$THTTPD_VER/thttpd /bin/thttpd
|
COPY --from=builder /usr/src/thttpd-$THTTPD_VER/thttpd /usr/local/bin/thttpd
|
||||||
COPY --from=builder /usr/src/dumb-init-$DI_VER/dumb-init /bin/dumb-init
|
COPY --from=builder /usr/src/app/public /var/www/html
|
||||||
COPY --from=builder /usr/src/app/public /static
|
|
||||||
COPY thttpd.conf /etc/thttpd.conf
|
COPY thttpd.conf /etc/thttpd.conf
|
||||||
|
|
||||||
# A static file server doesn't need root
|
# A static file server doesn't need root
|
||||||
USER 82:82
|
USER www-data:www-data
|
||||||
|
|
||||||
ENTRYPOINT [ "/bin/dumb-init", "--" ]
|
ENTRYPOINT [ "dumb-init", "--" ]
|
||||||
CMD [ "/bin/thttpd", "-D", "-C", "/etc/thttpd.conf" ]
|
CMD [ "/usr/local/bin/thttpd", "-D", "-C", "/etc/thttpd.conf" ]
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
port=8080
|
port=8080
|
||||||
dir=/static
|
dir=/var/www/html
|
||||||
|
|
|
||||||
Reference in a new issue