preciazo/rust/api.Dockerfile

26 lines
725 B
Text
Raw Permalink Normal View History

2024-03-11 13:54:02 +00:00
FROM cgr.dev/chainguard/wolfi-base AS base
WORKDIR /usr/src/app
RUN apk add --no-cache libgcc
2024-06-30 00:04:59 +00:00
FROM docker.io/rust:1 AS rs-build
2024-06-30 02:15:26 +00:00
# RUN apt-get update && apt-get install -y libsqlite3-dev sqlite3 && rm -rf /var/lib/apt/lists/*
2024-03-11 13:54:02 +00:00
WORKDIR /usr/src/app
COPY . .
RUN --mount=type=cache,sharing=locked,target=/root/.cargo/git \
--mount=type=cache,sharing=locked,target=/root/.cargo/registry \
--mount=type=cache,sharing=locked,target=/usr/src/app/target \
2024-06-30 02:15:26 +00:00
SQLX_OFFLINE=true cargo install --bin api --locked --path .
2024-03-11 13:54:02 +00:00
FROM base
2024-06-30 00:04:59 +00:00
RUN apk add --no-cache sqlite sqlite-libs tini
ENTRYPOINT ["tini", "--"]
2024-03-11 13:54:02 +00:00
2024-06-30 00:04:59 +00:00
# api
COPY --from=rs-build /usr/local/cargo/bin/api /usr/local/bin/api
2024-03-11 13:54:02 +00:00
ENV DB_PATH=/db/db.db
2024-06-30 00:04:59 +00:00
EXPOSE 8000
CMD ["api"]