-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
16 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,22 @@ | ||
# Build Cache image | ||
FROM fpco/stack-build-small:lts-19.2 as builder-cache | ||
FROM alpine:3.18 as builder | ||
|
||
COPY stack.yaml /mnt | ||
COPY *.cabal /mnt | ||
WORKDIR /mnt | ||
RUN rm -rf ~/.stack && \ | ||
stack config set system-ghc --global true && \ | ||
stack setup && \ | ||
stack install --ghc-options="-fPIC" --only-dependencies | ||
RUN apk --no-cache add ca-certificates git ghc curl musl-dev gmp-dev zlib-dev zlib-static pcre-dev xz make | ||
RUN curl -sSL https://github.com/commercialhaskell/stack/releases/download/v2.11.1/stack-2.11.1-linux-$(uname -m)-static.tar.gz | tar xvz && \ | ||
mv stack*/stack /usr/bin | ||
|
||
|
||
|
||
# Build phase | ||
FROM builder-cache as builder | ||
# FROM ghcr.io/erebe/wstunnel:build-cache as builder | ||
COPY . /mnt | ||
WORKDIR /mnt | ||
RUN rm -rf ~/.stack && \ | ||
stack config set system-ghc --global true && \ | ||
echo ' ld-options: -static' >> wstunnel.cabal ; \ | ||
stack install --no-install-ghc --system-ghc --ghc-options="-fPIC" --executable-stripping | ||
|
||
RUN echo ' ld-options: -static' >> wstunnel.cabal ; \ | ||
stack install --ghc-options="-fPIC" | ||
#RUN upx /root/.local/bin/wstunnel | ||
|
||
|
||
|
||
# Final Image | ||
FROM alpine:latest as runner | ||
|
||
LABEL org.opencontainers.image.source https://github.com/erebe/server | ||
|
||
COPY --from=builder /root/.local/bin/wstunnel / | ||
RUN adduser -D abc && chmod +x /wstunnel | ||
|
||
USER abc | ||
WORKDIR / | ||
FROM alpine:3.18 as final | ||
|
||
CMD ["/wstunnel"] | ||
COPY --from=builder /root/.local/bin/wstunnel . | ||
|
||
VOLUME /data | ||
CMD cp wstunnel /data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters