Spaces:
Runtime error
Runtime error
| # ======== 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"] | |