-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (35 loc) · 976 Bytes
/
Dockerfile
File metadata and controls
46 lines (35 loc) · 976 Bytes
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
45
46
# Dockerfile for php.rs - PHP interpreter written in Rust
# Build: docker build -t php-rs .
# Run: docker run -it --rm php-rs
FROM rust:1.75-slim AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
libpq-dev \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /app
# Copy workspace files
COPY Cargo.toml Cargo.lock ./
COPY crates ./crates
# Build release binary
RUN cargo build --release -p php-rs-sapi-cli
# Runtime stage
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
libpq5 \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Copy binary from builder
COPY --from=builder /app/target/release/php-rs /usr/local/bin/php-rs
# Create directory for PHP scripts
WORKDIR /var/www
# Set php-rs as entrypoint
ENTRYPOINT ["php-rs"]
# Default: show help
CMD ["--help"]