-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
44 lines (31 loc) · 1.22 KB
/
Dockerfile
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
# https://dev.to/rogertorres/first-steps-with-docker-rust-30oi
# Rust nightly as the base image
FROM rustlang/rust:nightly AS build
# Build aichat
RUN git clone https://github.com/sigoden/aichat.git
RUN cd aichat && cargo build --release && cd ..
# Create a new empty shell project
RUN USER=root cargo new --bin text-rpg
WORKDIR /text-rpg
# Copy our manifests
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
# Build only the dependencies to cache them
# NOTE: text-rpg becomes text_rpg for deps
RUN cargo build --release && rm -rf src && rm -f ./target/release/deps/text_rpg* && rm -f ./target/release/text-rpg*
# Copy the source code
COPY ./src ./src
# Build for release.
RUN cargo build --release
# The final base image
FROM debian:bookworm-slim
# Install some deps
RUN apt-get update && apt-get -y install sqlite3 openssl ca-certificates
# Copy from the previous build
COPY --from=build /text-rpg/target/release/text-rpg /usr/src/text-rpg
COPY --from=build /aichat/target/release/aichat /usr/src/aichat
ENV PATH="/usr/src/:$PATH"
RUN ls -la /usr/src/ && echo "$PATH"
# COPY --from=build /text-rpg/target/release/text-rpg/target/x86_64-unknown-linux-musl/release/text-rpg .
# Run the binary
CMD ["/usr/src/text-rpg"]