-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
349b227
commit 25c07ba
Showing
1 changed file
with
25 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,35 @@ | ||
# FROM rust as planner | ||
# WORKDIR /app | ||
# RUN cargo install cargo-chef | ||
# COPY . . | ||
# RUN cargo chef prepare --recipe-path recipe.json | ||
# Use a minimal Ubuntu image as the base image | ||
FROM ubuntu:latest as builder | ||
|
||
# FROM rust as cacher | ||
# WORKDIR /app | ||
# RUN cargo install cargo-chef | ||
# COPY --from=planner /app/recipe.json recipe.json | ||
# RUN cargo chef cook --release --recipe-path=recipe.json | ||
# Set the working directory inside the container | ||
WORKDIR /usr/src/app | ||
|
||
# FROM rust as builder | ||
# COPY . /app | ||
# WORKDIR /app | ||
# COPY --from=cacher /app/target target | ||
# COPY --from=cacher /usr/local/cargo /usr/local/cargo | ||
# RUN cargo build --release | ||
# Install necessary build dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
build-essential \ | ||
curl g++ pkg-config libx11-dev libasound2-dev libudev-dev libxkbcommon-x11-0 libwayland-dev libxkbcommon-dev | ||
|
||
# FROM bitnami/minideb:bookworm | ||
# COPY --from=builder /app/target/release/new_media /app/new_media | ||
# WORKDIR /app | ||
# Install Rust using rustup | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
|
||
# EXPOSE 8080 | ||
# CMD ["./new_media"] | ||
# Add Rust binaries to the PATH | ||
ENV PATH="/root/.cargo/bin:${PATH}" | ||
|
||
# -------------- | ||
|
||
# FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef | ||
# WORKDIR /app | ||
|
||
# FROM chef AS planner | ||
# COPY . . | ||
# RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
# FROM chef AS builder | ||
# COPY --from=planner /app/recipe.json recipe.json | ||
# RUN apt-get update -qq && apt-get -y install --no-install-recommends \ | ||
# libasound2-dev \ | ||
# libudev-dev \ | ||
# libwayland-dev \ | ||
# libxkbcommon-dev | ||
# # # Build dependencies - this is the caching Docker layer! | ||
# RUN cargo chef cook --release --features docker --recipe-path recipe.json | ||
|
||
# # Build application | ||
# COPY . . | ||
# RUN cargo build --release --features docker | ||
|
||
# # We do not need the Rust toolchain to run the binary! | ||
# FROM debian:bookworm-slim AS runtime | ||
# WORKDIR /app | ||
# COPY --from=builder /app/target/release/new_media /usr/local/bin | ||
|
||
# EXPOSE 8080 | ||
# ENTRYPOINT ["/usr/local/bin/new_media"] | ||
# Copy the rest of the application source code into the container | ||
COPY . . | ||
|
||
# Build the application | ||
RUN cargo build --release --features docker | ||
|
||
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef | ||
WORKDIR /app | ||
# Use a minimal Ubuntu image as the final base image | ||
FROM ubuntu:latest | ||
|
||
FROM chef AS planner | ||
COPY . . | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
# Set the working directory inside the container | ||
WORKDIR /usr/src/app | ||
|
||
FROM chef AS builder | ||
COPY --from=planner /app/recipe.json recipe.json | ||
RUN apt-get update -qq && apt-get -y install --no-install-recommends \ | ||
libasound2-dev \ | ||
libudev-dev \ | ||
libwayland-dev \ | ||
libxkbcommon-dev | ||
# Build dependencies - this is the caching Docker layer! | ||
RUN cargo chef cook --release --features docker --recipe-path recipe.json | ||
# Build application | ||
COPY . . | ||
RUN cargo build --release --features docker | ||
# Copy only the necessary files from the builder stage | ||
COPY --from=builder /usr/src/app/target/release/new_media . | ||
|
||
# We do not need the Rust toolchain to run the binary! | ||
FROM debian:bookworm-slim AS runtime | ||
WORKDIR /app | ||
COPY --from=builder /app/target/release/new_media /usr/local/bin | ||
ENTRYPOINT ["/usr/local/bin/app"] | ||
# Specify the command to run on container start | ||
CMD ["./new_media"] |