safe-nd 0.2.1

Safe Network Data Types
Documentation
FROM rust:latest

RUN addgroup --gid 1001 maidsafe && \
    adduser --uid 1001 --ingroup maidsafe --home /home/maidsafe --shell /bin/sh --disabled-password --gecos "" maidsafe && \
    # The parent container sets this to the 'staff' group, which causes problems
    # with reading code stored in Cargo's registry.
    chgrp -R maidsafe /usr/local

# Install fixuid for dealing with permissions issues with mounted volumes.
# We could perhaps put this into a base container at a later stage.
RUN USER=maidsafe && \
    GROUP=maidsafe && \
    curl -SsL https://github.com/boxboat/fixuid/releases/download/v0.4/fixuid-0.4-linux-amd64.tar.gz | tar -C /usr/local/bin -xzf - && \
    chown root:root /usr/local/bin/fixuid && \
    chmod 4755 /usr/local/bin/fixuid && \
    mkdir -p /etc/fixuid && \
    printf "user: $USER\ngroup: $GROUP\n" > /etc/fixuid/config.yml

RUN apt-get update -y && \
    mkdir /target && \
    chown maidsafe:maidsafe /target && \
    mkdir /usr/src/safe-nd && \
    chown maidsafe:maidsafe /usr/src/safe-nd && \
    apt-get clean -y && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src/safe-nd
COPY . .

USER maidsafe:maidsafe
ENV CARGO_TARGET_DIR=/target
RUN rustup component add rustfmt clippy && \
    cargo clippy --verbose --release --all-targets && \
    cargo test --verbose --release && \
    find /target/release/ -maxdepth 1 -type f -exec rm '{}' \;
ENTRYPOINT ["fixuid"]