mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-12-22 11:21:24 +00:00
Standardize prod dockerfiles
This commit is contained in:
parent
ac82d2dab0
commit
fa60b798f1
5 changed files with 88 additions and 6 deletions
73
docker/dev/Dockerfile.amd64
Normal file
73
docker/dev/Dockerfile.amd64
Normal file
|
@ -0,0 +1,73 @@
|
|||
FROM rustembedded/cross:x86_64-unknown-linux-musl AS builder
|
||||
|
||||
ARG UID=991
|
||||
ARG GID=991
|
||||
|
||||
ARG TOOLCHAIN=stable
|
||||
ARG TARGET=x86_64-unknown-linux-musl
|
||||
ARG TOOL=x86_64-linux-musl
|
||||
|
||||
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 arm64v8/alpine:3.11
|
||||
|
||||
ARG UID=991
|
||||
ARG GID=991
|
||||
ARG BINARY=pict-rs
|
||||
|
||||
COPY --from=builder /opt/build/repo/target/x86_64-unknown-linux-musl/release/$BINARY /usr/bin/$BINARY
|
||||
|
||||
RUN \
|
||||
apk add tini && \
|
||||
addgroup -g $GID pictrs && \
|
||||
adduser -D -G pictrs -g "" -h /opt/pictrs pictrs
|
||||
|
||||
VOLUME /mnt
|
||||
|
||||
RUN \
|
||||
chown -R pictrs:pictrs /mnt
|
||||
|
||||
WORKDIR /opt/pictrs
|
||||
USER pictrs
|
||||
ENTRYPOINT ["/sbin/tini", "--"]
|
||||
CMD ["/usr/bin/pict-rs", "-p", "/mnt", "-a", "0.0.0.0:8080", "-w", "thumbnail"]
|
|
@ -62,7 +62,12 @@ RUN \
|
|||
addgroup -g $GID pictrs && \
|
||||
adduser -D -G pictrs -g "" -h /opt/pictrs pictrs
|
||||
|
||||
VOLUME /mnt
|
||||
|
||||
RUN \
|
||||
chown -R pictrs:pictrs /mnt
|
||||
|
||||
WORKDIR /opt/pictrs
|
||||
USER pictrs
|
||||
ENTRYPOINT ["/sbin/tini", "--"]
|
||||
CMD ["/usr/bin/pict-rs"]
|
||||
CMD ["/usr/bin/pict-rs", "-p", "/mnt", "-a", "0.0.0.0:8080", "-w", "thumbnail"]
|
||||
|
|
|
@ -62,7 +62,12 @@ RUN \
|
|||
addgroup -g $GID pictrs && \
|
||||
adduser -D -G pictrs -g "" -h /opt/pictrs pictrs
|
||||
|
||||
VOLUME /mnt
|
||||
|
||||
RUN \
|
||||
chown -R pictrs:pictrs /mnt
|
||||
|
||||
WORKDIR /opt/pictrs
|
||||
USER pictrs
|
||||
ENTRYPOINT ["/sbin/tini", "--"]
|
||||
CMD ["/usr/bin/pict-rs"]
|
||||
CMD ["/usr/bin/pict-rs", "-p", "/mnt", "-a", "0.0.0.0:8080", "-w", "thumbnail"]
|
||||
|
|
|
@ -51,7 +51,7 @@ set -xe
|
|||
git checkout master
|
||||
|
||||
# Changing the docker-compose prod
|
||||
sed -i "s/asonix\/pictrs:.*/asonix\/pictrs:$new_tag/" ../prod/docker-compose.yml
|
||||
sed -i "s/asonix\/pictrs:.*/asonix\/pictrs:amd64-$new_tag/" ../prod/docker-compose.yml
|
||||
git add ../prod/docker-compose.yml
|
||||
|
||||
# The commit
|
||||
|
@ -72,6 +72,7 @@ docker push asonix/pictrs:x64-latest
|
|||
# Build for arm64v8 and arm32v7
|
||||
build_image $new_tag arm64v8
|
||||
build_image $new_tag arm32v7
|
||||
build_image $new_tag amd64
|
||||
|
||||
# Build for other archs
|
||||
# TODO
|
||||
|
|
|
@ -7,7 +7,5 @@ services:
|
|||
ports:
|
||||
- "127.0.0.1:8080:8080"
|
||||
restart: always
|
||||
environment:
|
||||
- PICTRS_PATH=/app/data
|
||||
volumes:
|
||||
- ./volumes/pictrs:/app/data
|
||||
- ./volumes/pictrs:/mnt
|
||||
|
|
Loading…
Reference in a new issue