Spaces:
Runtime error
Runtime error
File size: 1,306 Bytes
41f4c23 9552aa0 41f4c23 9552aa0 41f4c23 4b3d9d1 9552aa0 41f4c23 4b3d9d1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | # ======== Stage 1: Build ========
FROM rust:latest as builder
WORKDIR /usr/src/ferron
# Copy source code (Requires full source in project root)
COPY . .
# Build the release binaries
RUN cargo build --release
# ======== Stage 2: Final Image ========
FROM devuan/devuan:latest
# Copy compiled binaries from 'builder' stage
COPY --from=builder /usr/src/ferron/target/release/ferron /usr/sbin/ferron
COPY --from=builder /usr/src/ferron/target/release/ferron-passwd /usr/sbin/ferron-passwd
# Copy the configuration file
# --- Local မှာ 'ferron-docker.yaml' file ရှိပြီး အောက်က content အမှန် ဖြစ်ရမည် ---
COPY ferron-docker.yaml /etc/ferron.yaml
# Create webroot directory and copy content
# --- Local မှာ 'wwwroot' directory နှင့် content ရှိရမည် ---
RUN mkdir -p /var/www/ferron
COPY wwwroot/* /var/www/ferron/
# Create log directory
RUN mkdir -p /var/log/ferron
# Create user and set permissions
RUN useradd -d /nonexistent -s /usr/sbin/nologin -r ferron && \
chown -R ferron:ferron /var/www/ferron && \
chown -R ferron:ferron /var/log/ferron
# Expose the correct port
EXPOSE 8080
# Switch to the non-root user
USER ferron
# Set the runtime command
CMD ["/usr/sbin/ferron", "-c", "/etc/ferron.yaml"]
|