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 DI_VER=1.2.5
|
||||
|
||||
FROM ubuntu:latest AS builder
|
||||
FROM alpine:3 AS builder
|
||||
|
||||
|
||||
# =====BUILD BINARIES=====
|
||||
|
@ -10,26 +10,32 @@ WORKDIR /usr/src
|
|||
ARG THTTPD_VER
|
||||
ARG DI_VER
|
||||
|
||||
# Install dependencies & build thttpd
|
||||
RUN apt update && \
|
||||
apt install -y --no-install-recommends \
|
||||
curl \
|
||||
ca-certificates \
|
||||
hugo \
|
||||
musl-dev \
|
||||
musl-tools \
|
||||
build-essential && \
|
||||
curl -sSL "https://www.acme.com/software/thttpd/thttpd-$THTTPD_VER.tar.gz" | \
|
||||
# Install build dependencies
|
||||
# bash: required for dumb-init's Makefile
|
||||
# gcc, musl-dev: compilation
|
||||
# curl: downloading the tarballs
|
||||
# hugo: generating the static files
|
||||
RUN apk add --update --no-cache \
|
||||
bash \
|
||||
make \
|
||||
gcc \
|
||||
curl \
|
||||
hugo \
|
||||
musl-dev
|
||||
|
||||
# Build thttpd
|
||||
RUN curl -sSL "https://www.acme.com/software/thttpd/thttpd-$THTTPD_VER.tar.gz" | \
|
||||
tar xzf - && \
|
||||
cd "thttpd-$THTTPD_VER" && \
|
||||
CC="musl-gcc -static" ./configure && \
|
||||
make -j$(nproc)
|
||||
./configure && \
|
||||
make CCOPT="-O3 -s -static" -j$(nproc)
|
||||
|
||||
# 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" | \
|
||||
tar xzf - && \
|
||||
cd "dumb-init-$DI_VER" && \
|
||||
CC="musl-gcc -static" make build
|
||||
make build
|
||||
|
||||
|
||||
# =====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/dumb-init-$DI_VER/dumb-init /bin/dumb-init
|
||||
COPY --from=builder /usr/src/app/public /static
|
||||
COPY thttpd.conf /etc/thttpd.conf
|
||||
|
||||
# A static file server doesn't need root
|
||||
USER 82:82
|
||||
|
||||
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