go-http-tunnel
                                
                                
                                
                                    go-http-tunnel copied to clipboard
                            
                            
                            
                        Add docker image
- Adds customizable docker image for running tunneld
 
Thanks, I'll review it next week as I'm on a conference.
Hi @osiloke,
I've built your image successfully with some changes:
In the builder:
RUN apk add --no-cache git ca-certificates \
	&& go get -v github.com/mmatczuk/go-http-tunnel/cmd/tunneld
In the final image:
RUN apk add --no-cache openssl ca-certificates
ENV COUNTY="US" \
  STATE="New Jersey" \
  LOCATION="Piscataway" \
  ORGANISATION="Ecample" \
  ROOT_CN="Root" \
  ISSUER_CN="Example Ltd" \
  PUBLIC_CN="example.com" \
  ROOT_NAME="root" \
  ISSUER_NAME="example" \
  PUBLIC_NAME="public" \
  RSA_KEY_NUMBITS="2048" \
  DAYS="365"
Also, are you sure the env key COUNTY shouln't be COUNTRY?
Sorry for hijacking..
The .sh files should be executable (chmod +x )
@osiloke I really like this but ran into some issues with creating and reading the certs...  I mapped /etc/ssl/certs to a different volume than in the README.md.
Error sample:
[i] Start OpenSSL, cert file save path: /etc/ssl/certs
[i] Generate root.crt
Generating RSA private key, 2048 bit long modulus
....+++
.....................................+++
e is 65537 (0x10001)
Cannot modifiy certificate subject
cp: can't stat 'root.crt': No such file or directory
Also, like @ubergesundheit mentioned, I had to chmod +x the .sh files in the Dockerfile because I got a permission error on entrypoint.sh.
I tried to follow the README.md, but I feel it misses critical build steps that would make this addition even more friendly.
It would make even more sense to use a docker volume to store the certificates or even use certificates obtained from lets encrypt.
Create docker image:
docker volume create tunnel-certs
And then
docker run -v tunnel-certs:/etc/ssl/certs -p 4443:4443 tunneld/tunneld
Is there a plan to get this published in Docker Hub?
There is a plan to do that yet right now the focus is on streamlining the tunnel usage. Based on that there will be an official docker image.
Some news for this official image?
This is my draft of a very optimized image (4meg). You can remove 'tunnel' for server need (2meg)
FROM golang:alpine as builder EXPOSE 80 443 5223
RUN apk add --update bash git upx && rm -rf /var/cache/apk/* RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go get -u -ldflags="-s -w" -u github.com/mmatczuk/go-http-tunnel/cmd/... RUN upx -5 /go/bin/tunnel RUN upx -5 /go/bin/tunneld
FROM scratch COPY --from=builder /etc/passwd /etc/passwd EXPOSE 5223
COPY --from=builder /go/bin/tunneld /go/bin/tunneld
optional
COPY --from=builder /go/bin/tunnel /go/bin/tunnel
Run it:
docker run -d  -v pwd:/tunnel go-tunnel /go/bin/tunneld -tlsCrt /tunnel/server.crt -tlsKey /tunnel/server.key