diff --git a/Dockerfile b/Dockerfile index d03dfef..eb34f16 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,11 @@ -FROM alpine:3.12 - -ENV URL=http://localhost:8080 - +# builder image: +FROM alpine:3.12 as build ARG build_deps="go git" ARG runtime_deps="dumb-init" -ARG user_id=1000 COPY . /go/src/github.com/elisescu/tty-proxy - RUN apk update && \ apk add -u $build_deps $runtime_deps && \ - adduser -D -H -h / -u $user_id tty-proxy && \ cd /go/src/github.com/elisescu/tty-proxy && \ GOPATH=/go go get github.com/go-bindata/go-bindata/... && \ GOPATH=/go /go/bin/go-bindata --prefix static -o gobindata.go static/* && \ @@ -19,9 +14,17 @@ RUN apk update && \ rm -r /go && \ apk del $build_deps +# runtime image: +FROM alpine:3.12 +ARG user_id=1000 +RUN adduser -D -H -h / -u $user_id tty-proxy + EXPOSE 8080 EXPOSE 3456 USER tty-proxy +ENV URL=http://localhost:8080 ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/bin/sh", "-c", "/usr/bin/tty-proxy --front-address :8080 --back-address :3456 -url $URL"] + +COPY --from=build /usr/bin/dumb-init /usr/bin/tty-proxy /usr/bin/