-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored Dockerfile: thin container & can run private relay
- Loading branch information
Delfer
committed
Mar 27, 2018
1 parent
271e016
commit f358001
Showing
3 changed files
with
21 additions
and
9 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,26 +1,33 @@ | ||
FROM golang:alpine | ||
FROM golang:alpine AS builder | ||
LABEL maintainer="Kyle Manna <kyle@kylemanna.com>" | ||
|
||
ENV PKGVER 0.14.45 | ||
|
||
# Busybox wget needs TLS support, curl is less painful to get working | ||
RUN apk add --update ca-certificates curl && \ | ||
install -d src/github.com/syncthing && \ | ||
RUN apk add --no-cache ca-certificates curl && \ | ||
mkdir /go || true && \ | ||
cd /go && \ | ||
mkdir -p src/github.com/syncthing && \ | ||
export SRCDIR=$PWD && \ | ||
cd src/github.com/syncthing && \ | ||
echo curl -L https://github.com/syncthing/syncthing/releases/download/v$PKGVER/syncthing-source-v${PKGVER}.tar.gz && \ | ||
curl -L https://github.com/syncthing/syncthing/releases/download/v$PKGVER/syncthing-source-v${PKGVER}.tar.gz | tar xzf - && \ | ||
cd syncthing && \ | ||
export GOPATH="$SRCDIR" GOROOT_FINAL="/usr/bin" && \ | ||
go run build.go -no-upgrade -version v${PKGVER} build strelaysrv && \ | ||
install -Dm755 strelaysrv /usr/bin/strelaysrv && \ | ||
rm -rf $SRCDIR /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/* | ||
go run build.go -no-upgrade -version v${PKGVER} build strelaysrv | ||
|
||
#Building thin container | ||
FROM alpine | ||
|
||
RUN apk add --no-cache ca-certificates | ||
COPY --from=builder /go/src/github.com/syncthing/syncthing/strelaysrv /usr/bin/strelaysrv | ||
|
||
# Run unprivileged out of /relaysrv | ||
RUN mkdir /relaysrv && chown nobody:nobody /relaysrv | ||
VOLUME /relaysrv | ||
USER nobody | ||
WORKDIR /relaysrv | ||
|
||
EXPOSE 22067 22070 | ||
|
||
CMD ["/usr/bin/strelaysrv"] | ||
ENTRYPOINT ["/usr/bin/strelaysrv"] | ||
CMD [""] |
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