relay/docker/prod/Dockerfile.arm32v7

74 lines
1.4 KiB
Docker
Raw Normal View History

2020-06-10 22:45:59 +00:00
FROM rustembedded/cross:arm-unknown-linux-musleabihf AS arm32v7-builder
ARG UID=991
ARG GID=991
ENV TOOLCHAIN=stable
ENV TARGET=arm-unknown-linux-musleabihf
ENV TOOL=arm-linux-musleabihf
RUN \
apt-get update && \
apt-get upgrade -y
RUN \
addgroup --gid "${GID}" build && \
adduser \
--disabled-password \
--gecos "" \
--ingroup build \
--uid "${UID}" \
--home /opt/build \
build
ADD https://sh.rustup.rs /opt/build/rustup.sh
RUN \
chown -R build:build /opt/build
USER build
WORKDIR /opt/build
ENV PATH="$PATH:/opt/build/.cargo/bin"
RUN \
chmod +x rustup.sh && \
./rustup.sh --default-toolchain $TOOLCHAIN --profile minimal -y && \
rustup target add $TARGET
FROM arm32v7-builder as builder
ARG TAG=master
2021-02-10 04:19:58 +00:00
ARG REPOSITORY=https://git.asonix.dog/asonix/relay
2020-06-10 22:45:59 +00:00
ARG BINARY=relay
RUN \
git clone -b $TAG $REPOSITORY repo
WORKDIR /opt/build/repo
RUN \
cargo build --release --target $TARGET && \
$TOOL-strip target/$TARGET/release/$BINARY
2021-06-24 17:03:45 +00:00
FROM arm32v7/alpine:3.14
2020-06-10 22:45:59 +00:00
ARG UID=991
ARG GID=991
ARG BINARY=relay
2020-06-10 23:18:22 +00:00
ARG TARGET=arm-unknown-linux-musleabihf
2020-06-10 22:45:59 +00:00
RUN \
apk add tini && \
addgroup --gid $GID relay && \
adduser -D -G relay -u $UID -g "" -h /opt/relay relay && \
chown -R relay:relay /opt/relay
2020-06-10 23:18:22 +00:00
COPY --from=builder /opt/build/repo/target/$TARGET/release/$BINARY /usr/bin/$BINARY
2020-06-10 22:45:59 +00:00
EXPOSE 8080
WORKDIR /opt/relay
USER relay
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["relay"]