mirror of
https://github.com/mikedilger/chorus.git
synced 2026-03-04 06:36:27 +00:00
Updates to Dockerfile (image is now only 41.4 MB)
This commit is contained in:
parent
a6f2ac1ee7
commit
dac63f50f7
@ -1,39 +1,41 @@
|
||||
FROM rust:alpine as builder
|
||||
RUN apk add --no-cache git
|
||||
WORKDIR /root
|
||||
RUN git clone https://github.com/mikedilger/chorus
|
||||
WORKDIR /root/chorus
|
||||
RUN git checkout latest
|
||||
RUN cargo build --release
|
||||
RUN strip ./target/release/* || true
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
# Install system packages
|
||||
RUN apk add --no-cache curl gcc musl-dev openssl-dev pkgconfig git make cmake
|
||||
|
||||
# Install rust
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
# RUN apk add --no-cache curl gcc musl-dev openssl-dev pkgconfig git make cmake
|
||||
|
||||
# Setup chorus user and directories
|
||||
RUN adduser --system --home /opt/chorus --shell /bin/sh chorus && \
|
||||
mkdir -p /opt/chorus/etc /opt/chorus/src /opt/chorus/var /opt/chorus/sbin /opt/chorus/lib && \
|
||||
mkdir -p /opt/chorus/etc /opt/chorus/src/chorus /opt/chorus/var /opt/chorus/sbin /opt/chorus/lib && \
|
||||
mkdir -p /opt/chorus/var/chorus /opt/chorus/var/www && \
|
||||
mkdir -p /opt/chorus/lib/systemd/system && \
|
||||
chown -R chorus /opt/chorus
|
||||
|
||||
# Clone chorus
|
||||
WORKDIR /opt/chorus/src
|
||||
RUN git clone https://github.com/mikedilger/chorus
|
||||
COPY --from=builder /root/chorus/target/release/chorus /opt/chorus/sbin/chorus
|
||||
COPY --from=builder /root/chorus/target/release/chorus_cmd /opt/chorus/sbin/chorus_cmd
|
||||
COPY --from=builder /root/chorus/target/release/chorus_compress /opt/chorus/sbin/chorus_compress
|
||||
COPY --from=builder /root/chorus/target/release/chorus_dump /opt/chorus/sbin/chorus_dump
|
||||
COPY --from=builder /root/chorus/target/release/chorus_dump_approvals /opt/chorus/sbin/chorus_dump_approvals
|
||||
COPY --from=builder /root/chorus/target/release/chorus_moderate /opt/chorus/sbin/chorus_moderate
|
||||
|
||||
# Build chorus
|
||||
WORKDIR /opt/chorus/src/chorus
|
||||
RUN git checkout latest && ~/.cargo/bin/cargo build --release
|
||||
RUN install --mode=0700 --owner=chorus -t /opt/chorus/sbin/ \
|
||||
./target/release/chorus \
|
||||
./target/release/chorus_compress \
|
||||
./target/release/chorus_dump \
|
||||
./target/release/chorus_dump_approvals \
|
||||
./target/release/chorus_moderate \
|
||||
./target/release/chorus_cmd
|
||||
RUN chown -R chorus /opt/chorus/sbin && chmod 0700 /opt/chorus/sbin/*
|
||||
|
||||
COPY chorus.toml /opt/chorus/etc/chorus.toml
|
||||
RUN chown chorus /opt/chorus/etc/chorus.toml
|
||||
|
||||
VOLUME /opt/chorus/etc
|
||||
VOLUME /opt/chorus/var
|
||||
|
||||
WORKDIR /opt/chorus
|
||||
USER chorus
|
||||
ENV RUST_BACKTRACE=1
|
||||
ENV RUST_LOG=info
|
||||
|
||||
ENTRYPOINT ["/opt/chorus/sbin/chorus", "/opt/chorus/etc/chorus.toml"]
|
||||
ENTRYPOINT ["/opt/chorus/sbin/chorus", "/opt/chorus/etc/chorus.toml"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user