FROM rust:1.53-alpine3.13 AS builder

WORKDIR /src

# Install build dependencies
RUN apk add --no-cache \
    musl-dev \
    postgresql-dev

# Copy over source code
COPY Cargo.toml Cargo.lock ./
COPY src ./src/

RUN cargo build \
    --release


FROM alpine:3.13

COPY --from=builder /src/target/release/hilde /usr/local/bin/hilde

ENTRYPOINT [ "/usr/local/bin/hilde" ]