Skip to content

Commit 91b818b

Browse files
committed
change order for better caching
1 parent 9aca2a9 commit 91b818b

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN apt-get update \
1010
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
1111

1212
ARG OPENRESTY_VER=1.27.1.2
13-
ENV PATH /opt/openresty/nginx/sbin:$PATH
13+
ENV PATH=/opt/openresty/nginx/sbin:$PATH
1414

1515
WORKDIR /app
1616
RUN wget "https://openresty.org/download/openresty-${OPENRESTY_VER}.tar.gz" \
@@ -25,13 +25,13 @@ RUN mkdir -p /etc/nginx/ssl \
2525
&& openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
2626
-keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt -subj "/"
2727

28-
# add app source code
29-
COPY ./ koreader-sync-server
28+
# copy only the patch needed for the gin build step
29+
COPY gin.patch /tmp/gin.patch
3030

3131
# patch gin for https support
3232
RUN git clone https://github.com/ostinelli/gin \
3333
&& cd gin \
34-
&& patch -N -p1 < /app/koreader-sync-server/gin.patch \
34+
&& patch -N -p1 < /tmp/gin.patch \
3535
&& luarocks make --tree=/usr/local \
3636
&& cd .. \
3737
&& rm -rf gin
@@ -59,6 +59,9 @@ RUN mkdir /etc/service/koreader-sync-server \
5959
/etc/service/koreader-sync-server/run \
6060
&& chmod +x /etc/service/koreader-sync-server/run
6161

62+
# add app source code last so app changes don't invalidate dependency layers
63+
COPY ./ koreader-sync-server
64+
6265
VOLUME ["/var/log/redis", "/var/lib/redis"]
6366

6467
EXPOSE 7200

0 commit comments

Comments
 (0)