Removed config file; switched to alpine build & O3
parent
5e0f5d0c52
commit
35f6c4acbf
37
Dockerfile
37
Dockerfile
|
@ -2,7 +2,7 @@
|
||||||
ARG THTTPD_VER=2.29
|
ARG THTTPD_VER=2.29
|
||||||
ARG DI_VER=1.2.5
|
ARG DI_VER=1.2.5
|
||||||
|
|
||||||
FROM ubuntu:latest AS builder
|
FROM alpine:3 AS builder
|
||||||
|
|
||||||
|
|
||||||
# =====BUILD BINARIES=====
|
# =====BUILD BINARIES=====
|
||||||
|
@ -10,26 +10,32 @@ WORKDIR /usr/src
|
||||||
ARG THTTPD_VER
|
ARG THTTPD_VER
|
||||||
ARG DI_VER
|
ARG DI_VER
|
||||||
|
|
||||||
# Install dependencies & build thttpd
|
# Install build dependencies
|
||||||
RUN apt update && \
|
# bash: required for dumb-init's Makefile
|
||||||
apt install -y --no-install-recommends \
|
# gcc, musl-dev: compilation
|
||||||
curl \
|
# curl: downloading the tarballs
|
||||||
ca-certificates \
|
# hugo: generating the static files
|
||||||
hugo \
|
RUN apk add --update --no-cache \
|
||||||
musl-dev \
|
bash \
|
||||||
musl-tools \
|
make \
|
||||||
build-essential && \
|
gcc \
|
||||||
curl -sSL "https://www.acme.com/software/thttpd/thttpd-$THTTPD_VER.tar.gz" | \
|
curl \
|
||||||
|
hugo \
|
||||||
|
musl-dev
|
||||||
|
|
||||||
|
# Build thttpd
|
||||||
|
RUN 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 CCOPT="-O3 -s -static" -j$(nproc)
|
||||||
|
|
||||||
# Build dumb-init
|
# Build dumb-init
|
||||||
|
# dumb-init's Makefile already specifies static build flags, so we don't have to specify them
|
||||||
RUN curl -sSL "https://github.com/Yelp/dumb-init/archive/refs/tags/v$DI_VER.tar.gz" | \
|
RUN curl -sSL "https://github.com/Yelp/dumb-init/archive/refs/tags/v$DI_VER.tar.gz" | \
|
||||||
tar xzf - && \
|
tar xzf - && \
|
||||||
cd "dumb-init-$DI_VER" && \
|
cd "dumb-init-$DI_VER" && \
|
||||||
CC="musl-gcc -static" make build
|
make build
|
||||||
|
|
||||||
|
|
||||||
# =====BUILD BLOG=====
|
# =====BUILD BLOG=====
|
||||||
|
@ -52,10 +58,9 @@ ARG DI_VER
|
||||||
COPY --from=builder /usr/src/thttpd-$THTTPD_VER/thttpd /bin/thttpd
|
COPY --from=builder /usr/src/thttpd-$THTTPD_VER/thttpd /bin/thttpd
|
||||||
COPY --from=builder /usr/src/dumb-init-$DI_VER/dumb-init /bin/dumb-init
|
COPY --from=builder /usr/src/dumb-init-$DI_VER/dumb-init /bin/dumb-init
|
||||||
COPY --from=builder /usr/src/app/public /static
|
COPY --from=builder /usr/src/app/public /static
|
||||||
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 82:82
|
||||||
|
|
||||||
ENTRYPOINT [ "/bin/dumb-init", "--" ]
|
ENTRYPOINT [ "/bin/dumb-init", "--" ]
|
||||||
CMD [ "/bin/thttpd", "-D", "-C", "/etc/thttpd.conf" ]
|
CMD [ "/bin/thttpd", "-D", "-d", "/static", "-p", "8080" ]
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
port=8080
|
|
||||||
dir=/static
|
|
Reference in New Issue