Skip to content

Commit

Permalink
Dockerfile: Pass flags via enviroment variable (#16)
Browse files Browse the repository at this point in the history
* Dockerfile: pass env vars to flags in entrypoint

Signed-off-by: tiero <[email protected]>

* Dockerfile: skip debian warning

Signed-off-by: tiero <[email protected]>

* envars.Dockerfiles

Signed-off-by: tiero <[email protected]>

Signed-off-by: tiero <[email protected]>
  • Loading branch information
tiero authored Aug 29, 2022
1 parent 966d778 commit 94c113c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN cp /tor-proxy/torproxy .

FROM debian:buster-slim

RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates

COPY --from=builder /bin/torproxy /usr/local/bin/torproxy

Expand All @@ -34,4 +34,3 @@ USER torproxy
RUN mkdir -p "$HOME/.local/"

ENTRYPOINT ["torproxy"]

38 changes: 38 additions & 0 deletions envvars.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM golang:1.18-buster AS builder

ENV GO111MODULE=on \
CGO_ENABLED=0

WORKDIR /tor-proxy

COPY go.mod .
COPY go.sum .
RUN go mod download

COPY . .


RUN go build -o torproxy ./cmd/*.go

WORKDIR /bin

RUN cp /tor-proxy/torproxy .

FROM debian:buster-slim

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates

COPY --from=builder /bin/torproxy /usr/local/bin/torproxy

RUN chmod a+x /usr/local/bin/torproxy

RUN useradd -ms /bin/bash torproxy

USER torproxy

# Prevents `VOLUME $HOME/.local/` being created as owned by `root`
RUN mkdir -p "$HOME/.local/"


ENTRYPOINT torproxy start --insecure --port="${PORT}" --registry="${REGISTRY_URL}" --socks5-hostname="${SOCKS5_HOSTNAME}" --socks5-port="${SOCKS5_PORT}"

0 comments on commit 94c113c

Please sign in to comment.