-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
69 lines (55 loc) · 1.44 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#
# Build stage
#
FROM alpine:latest as build
# args
ARG version="master"
# build root
WORKDIR /build
RUN apk add \
git \
ca-certificates \
alpine-sdk \
clang \
cmake \
zlib-static zlib-dev \
lua5.1 lua5.1-dev \
linux-headers \
upx
# source
RUN git clone https://github.com/lpereira/lwan -b ${version} .
# build
RUN mkdir build \
&& cd build \
&& cmake \
.. \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_EXE_LINKER_FLAGS="-static" \
-DCMAKE_C_FLAGS="-static" \
&& make
# compress and test
RUN cd build \
&& ls -l src/bin/lwan \
&& upx --ultra-brute src/bin/lwan/lwan
# make a temp folder
RUN mkdir -p /tmp
#
# Final image
#
FROM scratch
# labels
LABEL org.label-schema.vcs-url="https://github.com/fabiomen10/quadl"
LABEL org.label-schema.version=${version}
LABEL org.label-schema.schema-version="0.0.2"
# copy binary and ca certs
COPY --from=build /build/build/src/bin/lwan/lwan /bin/lwan
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
# copy default configuration
COPY lwan.conf /etc/lwan.conf
# copy empty temp folder
COPY --from=build /tmp /tmp
# serve form /quadl
WORKDIR /quadl
EXPOSE 8080
ENTRYPOINT ["/bin/lwan", "--config", "/etc/lwan.conf"]