2020-11-08 09:56:39 +00:00
|
|
|
# Build Cache image
|
|
|
|
FROM alpine:3.12 as builder-cache
|
2017-10-22 12:58:16 +00:00
|
|
|
|
2020-01-05 23:37:16 +00:00
|
|
|
RUN apk --no-cache add ca-certificates git ghc curl musl-dev gmp-dev zlib-dev zlib-static pcre-dev xz make upx
|
|
|
|
RUN curl -sSL https://github.com/commercialhaskell/stack/releases/download/v2.1.3/stack-2.1.3-linux-x86_64-static.tar.gz | tar xvz && \
|
|
|
|
mv stack*/stack /usr/bin
|
|
|
|
|
2017-10-22 12:58:16 +00:00
|
|
|
|
|
|
|
COPY stack.yaml /mnt
|
|
|
|
COPY *.cabal /mnt
|
2020-01-05 23:37:16 +00:00
|
|
|
WORKDIR /mnt
|
|
|
|
RUN rm -rf ~/.stack && \
|
|
|
|
stack config set system-ghc --global true && \
|
|
|
|
stack setup && \
|
|
|
|
stack install --split-objs --ghc-options="-fPIC" --only-dependencies
|
2017-10-22 12:58:16 +00:00
|
|
|
|
2020-11-08 09:56:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Build phase
|
|
|
|
#FROM builder-cache as builder
|
|
|
|
FROM ghcr.io/erebe/wstunnel:build-cache as builder
|
2017-10-22 12:58:16 +00:00
|
|
|
COPY . /mnt
|
2020-01-05 23:37:16 +00:00
|
|
|
|
|
|
|
RUN echo ' ld-options: -static' >> wstunnel.cabal ; \
|
|
|
|
stack install --split-objs --ghc-options="-fPIC"
|
|
|
|
#RUN upx /root/.local/bin/wstunnel
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-08 09:56:39 +00:00
|
|
|
# Final Image
|
2020-01-05 23:37:16 +00:00
|
|
|
FROM alpine:latest as runner
|
|
|
|
MAINTAINER github@erebe.eu
|
|
|
|
|
2020-11-08 09:56:39 +00:00
|
|
|
LABEL org.opencontainers.image.source https://github.com/erebe/server
|
|
|
|
|
2020-11-05 13:23:35 +00:00
|
|
|
COPY --from=builder /root/.local/bin/wstunnel /
|
2020-11-05 13:49:58 +00:00
|
|
|
RUN adduser -D abc && chmod +x /wstunnel
|
|
|
|
|
2020-11-05 13:23:35 +00:00
|
|
|
USER abc
|
2020-11-05 13:49:58 +00:00
|
|
|
WORKDIR /
|
2020-01-05 23:37:16 +00:00
|
|
|
|
2020-11-05 13:23:35 +00:00
|
|
|
CMD ["/wstunnel"]
|
2020-01-05 23:37:16 +00:00
|
|
|
|