koreader-sync/Containerfile

86 lines
2.1 KiB
Docker

FROM docker.io/alpine:3.19 as builder
RUN apk --no-cache add \
bash \
coreutils \
perl \
make \
automake \
autoconf \
gcc \
git \
curl \
lua5.1-dev \
musl-dev \
pcre-dev \
zlib-dev \
lua5.1 \
luarocks5.1 \
openssl \
openssl-dev \
pcre-dev \
zlib-dev \
patch
RUN ln -s /usr/bin/aclocal-1.16 /usr/bin/aclocal-1.15
RUN ln -s /usr/bin/automake-1.16 /usr/bin/automake-1.15
ENV RESTY_VERSION=1.21.4.3
ENV RESTY_SHA256_SUM=33a84c63cfd9e46b0e5c62eb2ddc7b8068bda2e1686314343b89fc3ffd24cdd3
RUN wget https://openresty.org/download/openresty-$RESTY_VERSION.tar.gz
RUN echo "$RESTY_SHA256_SUM openresty-$RESTY_VERSION.tar.gz" | sha256sum -c - || exit 1
RUN tar xvf openresty-$RESTY_VERSION.tar.gz
RUN cd openresty-$RESTY_VERSION && \
./configure --with-pcre-jit --with-ipv6 --with-http_v2_module && \
make && \
make install
ADD gin.patch /gin.patch
RUN git clone https://github.com/ostinelli/gin
ENV GIN_VERSION=cb35e87fa0671fcf25e5bce5cb9487dee8b497e2
WORKDIR /gin
RUN git checkout "$GIN_VERSION"
RUN patch -N -p1 < ../gin.patch
RUN luarocks-5.1 make
WORKDIR /
RUN git clone https://github.com/koreader/koreader-sync-server.git
ENV SYNC_VERSION=14c64347627d07cf6e72552705bf1642a39a8908
WORKDIR /koreader-sync-server
RUN git checkout "$SYNC_VERSION"
FROM docker.io/thallian/confd-env:3.19-3.1.6.2
RUN addgroup syncer
RUN adduser -h /app -D -G syncer syncer
COPY --from=builder /usr/local/openresty /usr/local/openresty
COPY --from=builder /usr/local/share/lua/5.1 /usr/local/share/lua/5.1
COPY --from=builder /usr/local/lib/lua/5.1 /usr/local/lib/lua/5.1
COPY --from=builder /usr/local/lib/luarocks/rocks-5.1 /usr/local/lib/luarocks/rocks-5.1
COPY --from=builder /usr/local/bin/gin /usr/local/bin/gin
COPY --from=builder --chown=syncer:syncer /koreader-sync-server /app/server
RUN ln -s /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx
RUN apk --no-cache add \
redis \
openssl \
libgcc \
pcre \
lua5.1 \
unzip \
zlib
ADD /rootfs /
ENV GIN_ENV production
WORKDIR /
EXPOSE 7200
VOLUME /var/lib/redis/