2024-02-16 09:44:33 +00:00
|
|
|
FROM ghcr.io/cirruslabs/flutter:3.16.9 AS frontend_builder
|
2023-12-27 15:45:55 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
COPY frontend /app
|
|
|
|
RUN flutter build web --release
|
|
|
|
|
2023-12-23 18:27:36 +00:00
|
|
|
FROM rust AS builder
|
|
|
|
|
|
|
|
# Install necessary tools and dependencies
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Copy the Rust project files
|
2023-12-27 15:45:55 +00:00
|
|
|
COPY backend/src /app/src
|
|
|
|
COPY backend/scripts /app/scripts
|
|
|
|
COPY backend/Cargo.lock /app
|
|
|
|
COPY backend/Cargo.toml /app
|
|
|
|
|
|
|
|
COPY --from=frontend_builder /app/build/web /app/web
|
2023-12-23 18:27:36 +00:00
|
|
|
|
|
|
|
# Build the Rust binary
|
2023-12-27 15:45:55 +00:00
|
|
|
RUN cargo build --release --features static
|
2023-12-23 18:27:36 +00:00
|
|
|
|
|
|
|
# Stage 2: Create the final image
|
|
|
|
FROM archlinux
|
|
|
|
|
2024-01-06 20:53:48 +00:00
|
|
|
RUN echo $'\n\
|
2024-01-06 21:18:29 +00:00
|
|
|
[multilib]\n\
|
2024-01-06 21:29:13 +00:00
|
|
|
Include = /etc/pacman.d/mirrorlist'>> /etc/pacman.conf
|
2023-12-27 15:45:55 +00:00
|
|
|
|
2023-12-23 18:27:36 +00:00
|
|
|
RUN pacman -Syyu --noconfirm
|
2024-01-01 16:39:07 +00:00
|
|
|
RUN pacman-key --init && pacman-key --populate
|
2023-12-23 18:27:36 +00:00
|
|
|
RUN pacman -S --noconfirm base-devel git
|
|
|
|
RUN pacman -Sc
|
|
|
|
|
2024-01-06 21:29:13 +00:00
|
|
|
RUN echo $'\n\
|
|
|
|
[repo]\n\
|
|
|
|
SigLevel = Optional TrustAll\n\
|
|
|
|
Server = http://localhost:8080/' >> /etc/pacman.conf
|
|
|
|
|
2024-02-16 10:42:25 +00:00
|
|
|
# Copy the built binary from the previous stage
|
|
|
|
COPY --from=builder /app/target/release/untitled /usr/local/bin/untitled
|
|
|
|
|
2023-12-23 18:27:36 +00:00
|
|
|
# Set the entry point or default command to run your application
|
2023-12-23 22:00:30 +00:00
|
|
|
WORKDIR /app
|
2023-12-23 18:27:36 +00:00
|
|
|
CMD ["untitled"]
|