diff --git a/Dockerfile b/Dockerfile index f9ffc26..d73bc80 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ FROM rust:slim +ARG UID="1000" +ARG GID="1000" WORKDIR /usr/src/refractr COPY . . @@ -6,4 +8,8 @@ COPY . . RUN cargo build --release RUN cargo install --locked --path . -CMD ["refractr"] \ No newline at end of file +RUN groupadd -g $GID refractr +RUN useradd -u $UID -g $GID -MN refractr +USER refractr + +CMD ["refractr"] diff --git a/build b/build new file mode 100755 index 0000000..c143d0e --- /dev/null +++ b/build @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# Create all the different builds for refractr +set -x +version=$(cat Cargo.toml | grep -m1 version | awk -F' ' '{print $3}' | sed 's|"||g') + +# docker builds +cargo clean +docker build -t refractr:$version . +docker tag refractr:$version refractr:$latest + +# rust build +cargo build +cargo build --release