Split out arm dockerfile

This commit is contained in:
Marcus Noble 2020-09-12 10:17:19 +01:00
parent da48480ab8
commit b7c5a18c12
3 changed files with 31 additions and 19 deletions

View File

@ -1,30 +1,18 @@
FROM --platform=${BUILDPLATFORM:-linux/amd64} ubuntu:19.10 as builder FROM ubuntu:19.10
ARG BUILDPLATFORM
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
RUN apt-get update && apt-get install -y curl ca-certificates 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 RUN adduser --disabled-password --gecos '' mega && adduser mega sudo && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN curl -k -o /megacmd.deb https://mega.nz/linux/MEGAsync/xUbuntu_19.10/amd64/megacmd-xUbuntu_19.10_amd64.deb
RUN apt install -y ./megacmd.deb
ADD entrypoint.sh / ADD entrypoint.sh /
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh
FROM --platform=${TARGETPLATFORM:-linux/amd64} ubuntu:19.10
WORKDIR /home/mega WORKDIR /home/mega
COPY --from=builder /etc/sudoers /etc/sudoers
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /entrypoint.sh /entrypoint.sh
COPY --from=builder /megacmd.deb /megacmd.deb
RUN apt install -y ./megacmd.deb
USER mega USER mega
ENV PASSWORD= ENV PASSWORD=
ENV EMAIL= ENV EMAIL=
CMD /entrypoint.sh CMD /entrypoint.sh

18
Dockerfile.arm6 Normal file
View File

@ -0,0 +1,18 @@
FROM ubuntu:19.10
RUN apt-get update && apt-get install -y curl ca-certificates
RUN adduser --disabled-password --gecos '' mega && adduser mega sudo && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN curl -k -o /megacmd.deb https://mega.nz/linux/MEGAsync/Raspbian_10.0/armhf/megacmd-Raspbian_10.0_armhf.deb
RUN apt install -y ./megacmd.deb
ADD entrypoint.sh /
RUN chmod +x /entrypoint.sh
WORKDIR /home/mega
USER mega
ENV PASSWORD=
ENV EMAIL=
CMD /entrypoint.sh

View File

@ -1,7 +1,6 @@
.DEFAULT_GOAL := default .DEFAULT_GOAL := default
IMAGE ?= docker.cluster.fun/averagemarcus/megasync:latest IMAGE ?= docker.cluster.fun/averagemarcus/megasync:latest
PLATFORMS ?= linux/amd64,linux/arm/v7
export DOCKER_CLI_EXPERIMENTAL=enabled export DOCKER_CLI_EXPERIMENTAL=enabled
@ -44,11 +43,18 @@ docker-build:
docker-publish: docker-publish:
@docker buildx create --use --name=crossplat --node=crossplat && \ @docker buildx create --use --name=crossplat --node=crossplat && \
docker buildx build \ docker buildx build \
--platform $(PLATFORMS) \
--output "type=image,push=true" \ --output "type=image,push=true" \
--tag $(IMAGE) \ --tag $(IMAGE) \
. .
.PHONY: docker-publish-arm # Build and push the armhf image (needs to be built on ARM hardware)
docker-publish-arm:
@docker buildx create --use --name=crossplat --node=crossplat && \
docker buildx build \
--output "type=image,push=true" \
--tag $(IMAGE)-armhf \
.
.PHONY: run # Run the application .PHONY: run # Run the application
run: run:
@echo "⚠️ 'run' unimplemented" @echo "⚠️ 'run' unimplemented"