58 lines
1.5 KiB
Docker
58 lines
1.5 KiB
Docker
# Build the ProtonMail Bridge.
|
|
FROM golang:1.18-buster as build
|
|
ENV LANG C.UTF-8
|
|
|
|
# Install required build packages
|
|
RUN apt-get update \
|
|
&& apt-get install -y \
|
|
bash \
|
|
build-essential \
|
|
curl \
|
|
git \
|
|
libsecret-1-dev \
|
|
musl-dev
|
|
|
|
# Download/build the application
|
|
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 \
|
|
&& export PROTON_BRIDGE="proton-bridge-$(echo $RELEASE | sed -e 's/^\(v\|br\)//')" \
|
|
&& ln -s "${PROTON_BRIDGE}" 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 debian:stable
|
|
ENV LANG C.UTF-8
|
|
|
|
EXPOSE 25/tcp
|
|
EXPOSE 143/tcp
|
|
|
|
COPY --from=build /usr/src/proton-bridge/proton-bridge /bin/proton-bridge
|
|
COPY --from=build /usr/src/proton-bridge/bridge /bin/bridge
|
|
COPY entrypoint /bin/
|
|
COPY initproton /bin/
|
|
RUN apt-get update\
|
|
&& apt-get install -y --no-install-recommends --no-install-suggests\
|
|
libcap2\
|
|
libsecret-1-0\
|
|
gosu\
|
|
gpg-agent\
|
|
pass\
|
|
socat\
|
|
&& rm -rf /var/lib/apt/lists/*\
|
|
&& chmod +x /bin/entrypoint\
|
|
&& chmod +x /bin/initproton
|
|
|
|
WORKDIR /var/lib/proton
|
|
|
|
ENTRYPOINT ["/bin/entrypoint"]
|
|
CMD ["/bin/initproton"]
|