Sam Jeston
History
26 lines·
799 Bytes
·Dockerfile
| 1 | # syntax=docker/dockerfile:1 |
| 2 | |
| 3 | FROM rust:1.88-bookworm AS build |
| 4 | WORKDIR /src |
| 5 | COPY Cargo.toml Cargo.lock ./ |
| 6 | COPY migrations migrations |
| 7 | COPY src src |
| 8 | COPY static static |
| 9 | COPY templates templates |
| 10 | RUN cargo build --release --locked |
| 11 | |
| 12 | FROM debian:bookworm-slim |
| 13 | # git serves fetches and pushes; everything else is in the binary. |
| 14 | RUN apt-get update \ |
| 15 | && apt-get install -y --no-install-recommends git ca-certificates \ |
| 16 | && rm -rf /var/lib/apt/lists/* \ |
| 17 | && useradd --system --home-dir /data --shell /usr/sbin/nologin openhub \ |
| 18 | && mkdir /data && chown openhub:openhub /data |
| 19 | COPY --from=build /src/target/release/openhub /usr/local/bin/openhub |
| 20 | USER openhub |
| 21 | ENV OPENHUB_DATA_DIR=/data \ |
| 22 | OPENHUB_HTTP_ADDR=0.0.0.0:3000 \ |
| 23 | OPENHUB_SSH_ADDR=0.0.0.0:2222 |
| 24 | VOLUME /data |
| 25 | EXPOSE 3000 2222 |
| 26 | ENTRYPOINT ["openhub"] |