diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 523745f..26ee243 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Login to DockerHub + if: github.repository == 'erebe/wstunnel' uses: docker/login-action@v1 with: registry: ghcr.io @@ -29,7 +30,7 @@ jobs: id: docker_build_wstunnel uses: docker/build-push-action@v2 with: - push: true + push: ${{ github.repository == 'erebe/wstunnel' && github.ref == 'refs/heads/master' }} tags: ghcr.io/erebe/wstunnel:latest # - name: extract Artifact diff --git a/Dockerfile b/Dockerfile index 204fda8..8cffd07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,23 @@ # Build Cache image -FROM alpine:3.12 as builder-cache - -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 - +FROM fpco/stack-build-small:lts-19.2 as builder-cache COPY stack.yaml /mnt COPY *.cabal /mnt WORKDIR /mnt -RUN sed -i 's/lts-16.25/lts-16.4/' stack.yaml && \ - rm -rf ~/.stack && \ +RUN rm -rf ~/.stack && \ stack config set system-ghc --global true && \ stack setup && \ - stack install --split-objs --ghc-options="-fPIC" --only-dependencies + stack install --ghc-options="-fPIC" --only-dependencies # Build phase -#FROM builder-cache as builder -FROM ghcr.io/erebe/wstunnel:build-cache as builder +FROM builder-cache as builder +# FROM ghcr.io/erebe/wstunnel:build-cache as builder COPY . /mnt -RUN sed -i 's/lts-16.25/lts-16.4/' stack.yaml RUN echo ' ld-options: -static' >> wstunnel.cabal ; \ - stack install --split-objs --ghc-options="-fPIC" + stack install --ghc-options="-fPIC" #RUN upx /root/.local/bin/wstunnel diff --git a/src/Types.hs b/src/Types.hs index 3e2c110..cf9c8cb 100644 --- a/src/Types.hs +++ b/src/Types.hs @@ -36,7 +36,7 @@ defaultRecvBufferSize = unsafeDupablePerformIO $ bracket (N.socket N.AF_INET N.Stream 0) N.close (\sock -> N.getSocketOption sock N.RecvBuffer) sO_MARK :: N.SocketOption -sO_MARK = N.CustomSockOpt (1, 36) -- https://elixir.bootlin.com/linux/latest/source/arch/alpha/include/uapi/asm/socket.h#L64 +sO_MARK = N.SockOpt 1 36 -- https://elixir.bootlin.com/linux/latest/source/arch/alpha/include/uapi/asm/socket.h#L64 {-# NOINLINE sO_MARK_Value #-} sO_MARK_Value :: IORef Int diff --git a/stack.yaml b/stack.yaml index 5d39750..09e671f 100644 --- a/stack.yaml +++ b/stack.yaml @@ -15,7 +15,7 @@ # resolver: # name: custom-snapshot # location: "./custom-snapshot.yaml" -resolver: lts-16.25 +resolver: lts-19.2 # User packages to be built. # Various formats can be used as shown in the example below. diff --git a/wstunnel.cabal b/wstunnel.cabal index 2e70acd..a46e2d8 100644 --- a/wstunnel.cabal +++ b/wstunnel.cabal @@ -26,7 +26,7 @@ library , connection , hslogger , mtl - , network + , network >= 3.1.2 , network-conduit-tls , streaming-commons , text >= 1.2.2.1