66FROM rustlang/rust:nightly-bullseye-slim AS builder
77WORKDIR /app
88
9- # Install build dependencies.
9+ # Install build dependencies
1010RUN apt-get update && \
1111 apt-get install -y pkg-config libssl-dev && \
1212 rm -rf /var/lib/apt/lists/*
1313
14- # Copy Cargo manifests and cache dependencies.
14+ # Copy Cargo manifests and cache dependencies
1515COPY Cargo.toml Cargo.lock ./
1616
17- # Create a dummy main file to allow dependency caching.
17+ # Create a dummy main file to allow dependency caching
1818RUN mkdir src && echo "fn main() {}" > src/main.rs
1919
20- # Build a dummy release binary (to cache dependencies).
20+ # Build a dummy release binary (to cache dependencies)
2121RUN cargo build --release
2222
23- # Now copy the full source code.
24- COPY . .
23+ # Copy the full source code, including dashboard.html
24+ COPY src/ src/
2525
26- # Build the real release binary.
26+ # Build the real release binary
2727RUN cargo build --release
2828
2929# #############################
@@ -32,30 +32,30 @@ RUN cargo build --release
3232FROM ubuntu:20.04
3333WORKDIR /app
3434
35- # Install runtime dependencies.
35+ # Install runtime dependencies
3636RUN apt-get update && \
3737 apt-get install -y ca-certificates libssl1.1 && \
3838 rm -rf /var/lib/apt/lists/*
3939
40- # Create a non-root user.
40+ # Create a non-root user
4141RUN groupadd -r appgroup && useradd -r -g appgroup appuser
4242
43- # Create and set permissions for directories.
43+ # Create and set permissions for directories
4444RUN mkdir -p /app/queue_db /app/data && \
4545 chown -R appuser:appgroup /app /app/queue_db /app/data && \
4646 chmod -R 775 /app /app/queue_db /app/data
4747
48- # Copy the compiled binary from the builder stage.
48+ # Copy the compiled binary from the builder stage
4949COPY --from=builder /app/target/release/timefusion /usr/local/bin/timefusion
5050
51- # Adjust ownership of the binary.
51+ # Adjust ownership of the binary
5252RUN chown appuser:appgroup /usr/local/bin/timefusion
5353
54- # Expose the required ports.
55- EXPOSE 8080 5432
54+ # Expose the required ports
55+ EXPOSE 80 5432
5656
57- # Switch to the non-root user.
57+ # Switch to the non-root user
5858USER appuser
5959
60- # Start the application.
60+ # Start the application
6161ENTRYPOINT ["/usr/local/bin/timefusion" ]
0 commit comments