make it run on alpine 3.11

This commit is contained in:
Sebastian Hugentobler 2019-12-21 12:37:52 +01:00
parent 1c63243d18
commit 8d64896e73
3 changed files with 76 additions and 42 deletions

View File

@ -1,41 +1,81 @@
FROM thallian/confd-env:latest
FROM alpine:3.11 as builder
ENV OPENRESTY_VERSION 1.11.2.4
ENV RESTY_VERSION=1.15.8.2
ENV RESTY_SHA256_SUM=436b4e84d547a97a18cf7a2522daf819da8087b188468946b5a89c0dd1ca5d16
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
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
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
WORKDIR /gin
RUN patch -N -p1 < ../gin.patch
RUN luarocks-5.1 make
WORKDIR /
RUN git clone https://github.com/koreader/koreader-sync-server.git
FROM thallian/confd-env:latest
RUN addgroup syncer
RUN adduser -h /app -D -G syncer syncer
RUN apk --no-cache add tar redis make git libressl libssl1.0 perl gcc musl-dev pcre pcre-dev openssl-dev lua lua-dev unzip zlib zlib-dev curl luarocks libgcc
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
WORKDIR /app
RUN ln -s /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx
RUN luarocks-5.1 install luasec
RUN luarocks-5.1 install luaposix
RUN luarocks-5.1 install redis-lua
RUN luarocks-5.1 install busted
RUN apk --no-cache add \
redis \
openssl \
libgcc \
pcre \
lua5.1 \
unzip \
zlib
RUN mkdir /app/openresty
RUN wget -qO- https://openresty.org/download/openresty-$OPENRESTY_VERSION.tar.gz | tar -xz -C /app/openresty --strip 1
WORKDIR /app/openresty
RUN ./configure --prefix=/opt/openresty && make && make install
ENV PATH /opt/openresty/nginx/sbin:$PATH
WORKDIR /app
RUN git clone https://github.com/ostinelli/gin
ADD /rootfs /
RUN cd gin && patch -N -p1 < ../gin.patch
RUN cd gin && luarocks-5.1 make
ENV GIN_ENV production
RUN git clone https://github.com/koreader/koreader-sync-server.git server
RUN chown -R syncer:syncer /app
WORKDIR /
RUN ln -s /usr/lib/lua /usr/local/lib/lua
RUN ln -s /usr/share/lua/ /usr/local/share/lua
RUN apk del tar make git gcc musl-dev pcre-dev openssl-dev lua-dev zlib-dev
#RUN ln -s /usr/lib/lua /usr/local/lib/lua
#RUN ln -s /usr/share/lua/ /usr/local/share/lua
EXPOSE 7200
VOLUME /var/lib/redis/

View File

@ -1,19 +1,8 @@
[Koreader Sync Server](https://github.com/koreader/koreader-sync-server) to sync [Koreader](https://github.com/koreader/koreader) devices.
[Koreader Sync Server](https://github.com/koreader/koreader-sync-server) to sync
[Koreader](https://github.com/koreader/koreader) devices.
# Volumes
- `/var/lib/redis/`
- `/etc/ssl/nginx/:ro`: certificates must be here
# Environment Variables
## CERT_NAME
- default: fullchain.pem
Name of the certificate file.
## KEY_NAME
- default: privkey.pem
Name of the key file.
# Ports
- 7200

View File

@ -3,10 +3,15 @@ index b9601ec..55f4469 100644
--- a/gin-0.2.0-1.rockspec
+++ b/gin-0.2.0-1.rockspec
@@ -18,8 +18,9 @@ dependencies = {
"busted = 2.0.rc10-0",
"lua-cjson = 2.1.0-1",
- "lua = 5.1",
+ "lua = 5.1",
"ansicolors = 1.0.2-3",
- "busted = 2.0.rc10-0",
+ "busted = 2.0.0-1",
- "lua-cjson = 2.1.0-1",
+ "lua-cjson = 2.1.0.6-1",
"luasocket = 3.0rc1-2",
+ "luasec = 0.5-2",
+ "luasec = 0.9-1",
"luafilesystem = 1.6.3-1",
- "luaposix = 33.3.1-1",
+ "luaposix = 33.4.0",
@ -44,4 +49,4 @@ index 5ef537a..21ec8f9 100644
+ local ok, response_status, response_headers = http_request({
method = request.method,
url = full_url,
source = ltn12.source.string(request.body),
source = ltn12.source.string(request.body),