megasync/Dockerfile

30 lines
972 B
Docker
Raw Normal View History

2020-09-11 21:17:27 +00:00
FROM --platform=${BUILDPLATFORM:-linux/amd64} ubuntu:19.10 as builder
2020-06-07 11:50:01 +00:00
2020-09-11 21:17:27 +00:00
ARG BUILDPLATFORM
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
RUN apt-get update && apt-get install -y curl ca-certificates
RUN export URL="https://mega.nz/linux/MEGAsync/Raspbian_10.0/armhf/megacmd-Raspbian_10.0_armhf.deb" && \
if [ "${TARGETARCH}" = "amd64" ] ; then export URL="https://mega.nz/linux/MEGAsync/xUbuntu_19.10/amd64/megacmd-xUbuntu_19.10_amd64.deb" ; fi && \
curl -k -o /megacmd.deb $URL
RUN adduser --disabled-password --gecos '' mega && adduser mega sudo && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
2020-06-07 11:50:01 +00:00
ADD entrypoint.sh /
2020-06-07 13:43:15 +00:00
RUN chmod +x /entrypoint.sh
2020-06-07 11:50:01 +00:00
2020-09-11 21:17:27 +00:00
FROM --platform=${TARGETPLATFORM:-linux/amd64} ubuntu:19.10
USER mega
2020-06-07 11:50:01 +00:00
WORKDIR /home/mega
2020-09-11 21:17:27 +00:00
COPY --from=builder /etc/sudoers /etc/sudoers
COPY --from=builder /entrypoint.sh /entrypoint.sh
COPY --from=builder /megacmd.deb /megacmd.deb
RUN apt install -y ./megacmd.deb
2020-06-07 11:50:01 +00:00
ENV PASSWORD=
ENV EMAIL=
CMD /entrypoint.sh