0
0
docker-images/dockerfiles/redlib.Dockerfile

51 lines
2.1 KiB
Docker
Raw Permalink Normal View History

2024-10-09 19:43:10 +08:00
# Build the redlib binary
2024-10-09 07:04:17 +08:00
FROM rust:alpine3.19 AS builder
ARG TARGET=aarch64-unknown-linux-musl
# Install necessary packages for building the application
RUN apk add --no-cache curl git musl-dev
# Clone the redlib repository and build
RUN git clone https://github.com/redlib-org/redlib && \
cd redlib && \
2024-10-09 19:43:10 +08:00
sed -i 's/--green: #5cff85;/--green: #0A8754;/g' static/style.css && \
2024-10-13 01:27:20 +08:00
sed -i 's/--accent: #d54455;/--accent: #4385BE;/g' static/style.css && \
2024-10-09 22:50:14 +08:00
sed -i 's/--text: black;/--text: #0F0F0F;/g' static/style.css && \
2024-10-13 01:27:20 +08:00
sed -i 's/--accent: #bb2b3b;/--accent: #2968AC;/g' static/style.css && \
2024-10-09 22:50:14 +08:00
sed -i 's/--text: white;/--text: #CFCFCF;/g' static/themes/black.css && \
sed -i 's/--panel-border: 1px solid #ccc;/--panel-border: 1px solid #eee;/g' static/style.css && \
sed -i 's/--panel-border: 1px solid #333;/--panel-border: 1px solid #161616;/g' static/style.css && \
2024-10-13 01:27:20 +08:00
sed -i 's/#bb2b3b/#2968AC/g' static/themes/black.css && \
2024-10-09 22:50:14 +08:00
sed -i 's/--text: black;/--text: #0F0F0F;/g' static/themes/light.css && \
2024-10-13 01:27:20 +08:00
sed -i 's/#bb2b3b/#4385BE/g' static/themes/light.css && \
2024-10-09 22:50:14 +08:00
sed -i 's/--panel-border: 1px solid #ccc;/--panel-border: 1px solid #eee;/g' static/themes/light.css && \
2024-10-13 01:27:20 +08:00
sed -i 's/#d54455/#4385BE/g' static/themes/dark.css && \
2024-10-09 22:50:14 +08:00
sed -i 's/--panel-border: 1px solid #333;/--panel-border: 1px solid #161616;/g' static/themes/dark.css && \
2024-10-09 07:04:17 +08:00
cargo build --release --target=${TARGET} && \
cp target/${TARGET}/release/redlib /usr/local/bin/redlib && \
cd .. && \
rm -rf redlib
2024-10-09 19:43:10 +08:00
##################################################
# Create the final image
2024-10-09 07:04:17 +08:00
FROM alpine:3.19
RUN apk add --no-cache curl
# Create a non-root user
RUN adduser --home /nonexistent --no-create-home --disabled-password redlib
# Copy the compiled binary from the builder stage
COPY --from=builder /usr/local/bin/redlib /usr/local/bin/redlib
# Tell Docker to expose port 8080
EXPOSE 8080
# Run a healthcheck every minute to make sure redlib is functional
HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider -q http://localhost:8080/settings || exit 1
USER redlib
CMD ["redlib"]