2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 11:21:24 +00:00

Version v0.1.0-r5

This commit is contained in:
asonix 2020-06-07 20:16:18 -05:00
parent c0f4199621
commit ac82d2dab0
3 changed files with 89 additions and 12 deletions

View file

@ -0,0 +1,68 @@
FROM rustembedded/cross:arm-unknown-linux-musleabihf AS builder
ARG UID=991
ARG GID=991
ARG TOOLCHAIN=stable
ARG TARGET=arm-unknown-linux-musleabihf
ARG TOOL=arm-linux-musleabihf
ARG REPOSITORY=https://git.asonix.dog/asonix/pict-rs
ARG TAG=master
ARG BINARY=pict-rs
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=/opt/build/.cargo/bin:/usr/local/musl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN \
chmod +x rustup.sh && \
./rustup.sh --default-toolchain $TOOLCHAIN --profile minimal -y && \
rustup target add $TARGET
RUN \
git clone -b $TAG $REPOSITORY repo
WORKDIR /opt/build/repo
RUN \
cargo build --release --target $TARGET && \
$TOOL-strip target/$TARGET/release/$BINARY
FROM arm32v7/alpine:3.11
ARG UID=991
ARG GID=991
ARG BINARY=pict-rs
COPY --from=builder /opt/build/repo/target/arm-unknown-linux-musleabihf/release/$BINARY /usr/bin/$BINARY
RUN \
apk add tini && \
addgroup -g $GID pictrs && \
adduser -D -G pictrs -g "" -h /opt/pictrs pictrs
WORKDIR /opt/pictrs
USER pictrs
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/usr/bin/pict-rs"]

View file

@ -18,6 +18,23 @@ function print_help() {
echo " tag: The git tag to be applied to the repository and docker build"
}
function build_image() {
tag=$1
arch=$2
docker build \
--pull \
--no-cache \
--build-arg TAG=$tag \
-t asonix/pictrs:$arch-$tag \
-t asonix/pictrs:$arch-latest \
-f Dockerfile.$arch \
.
docker push asonix/pictrs:$arch-$tag
docker push asonix/pictrs:$arch-latest
}
# Creating the new tag
new_tag="$1"
@ -52,17 +69,9 @@ docker tag dev_pictrs:latest asonix/pictrs:x64-latest
docker push asonix/pictrs:x64-$new_tag
docker push asonix/pictrs:x64-latest
# Build for arm64v8
docker build \
--pull \
--no-cache \
--build-arg TAG=$new_tag \
-t asonix/pictrs:arm64v8-$new_tag \
-t asonix/pictrs:arm64v8-latest \
-f Dockerfile.arm64v8 \
.
docker push asonix/pictrs:arm64v8-$new_tag
docker push asonix/pictrs:arm64v8-latest
# Build for arm64v8 and arm32v7
build_image $new_tag arm64v8
build_image $new_tag arm32v7
# Build for other archs
# TODO

View file

@ -2,7 +2,7 @@ version: '3.3'
services:
pictrs:
image: asonix/pictrs:v0.1.0-r4
image: asonix/pictrs:v0.1.0-r5
user: root
ports:
- "127.0.0.1:8080:8080"