protonmail-bridge/Dockerfile

49 lines
1.2 KiB
Docker

# Build the ProtonMail Bridge.
FROM golang:1.16-alpine as build
ENV LANG C.UTF-8
RUN apk add --no-cache \
bash \
curl \
gcc \
git \
libsecret-dev \
make \
musl-dev
WORKDIR /usr/src
ARG RELEASE
ARG TAG
RUN if [ -n "$RELEASE" ]; then \
echo "Using release $RELEASE..." \
&& curl -L -s "https://github.com/ProtonMail/proton-bridge/archive/$RELEASE.tar.gz" | tar zx \
&& ln -s "proton-bridge-$RELEASE" proton-bridge \
&& cd proton-bridge \
; else \
git clone https://github.com/ProtonMail/proton-bridge.git proton-bridge \
&& cd proton-bridge \
&& if [ -n "$TAG" ]; then echo "Using tags/$TAG..."; git checkout tags/$TAG; fi \
; fi \
&& make build-nogui
# Create a container for the ProtonMail Bridge.
FROM alpine:edge
ENV LANG C.UTF-8
EXPOSE 25/tcp
EXPOSE 143/tcp
COPY --from=build /usr/src/proton-bridge/proton-bridge /bin/proton-bridge
COPY entrypoint /bin/
COPY initproton /bin/
RUN apk add --no-cache \
libsecret \
pass \
socat \
su-exec \
&& chmod +x /bin/entrypoint \
&& chmod +x /bin/initproton
WORKDIR /var/lib/proton
ENTRYPOINT ["/bin/entrypoint"]
CMD ["/bin/initproton"]