You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
2.4 KiB

# ---------------------------------------------------------------------------
# BACKEND
# ---------------------------------------------------------------------------
FROM rust:bullseye AS builder_be
RUN apt-get update && apt-get install -y libuv1 libuv1-dev
# Cassandra driver C++ dependency
WORKDIR /dependencies
RUN curl -o cassandra-cpp-driver.deb https://downloads.datastax.com/cpp-driver/ubuntu/18.04/cassandra/v2.16.0/cassandra-cpp-driver_2.16.0-1_amd64.deb
RUN curl -o cassandra-cpp-driver-dev.deb https://downloads.datastax.com/cpp-driver/ubuntu/18.04/cassandra/v2.16.0/cassandra-cpp-driver-dev_2.16.0-1_amd64.deb
RUN dpkg --ignore-depends=multiarch-support -i cassandra-cpp-driver.deb && rm cassandra-cpp-driver.deb
RUN dpkg --ignore-depends=multiarch-support -i cassandra-cpp-driver-dev.deb && rm cassandra-cpp-driver-dev.deb
WORKDIR /backend
# Cache the super slow updating crates.io index step
COPY ../backend/Cargo.toml .
COPY ../backend/Cargo.lock .
RUN mkdir ./src && echo 'fn main() { println!("I am the cache-carrot"); }' > ./src/main.rs
RUN cargo build # --release # Cache
RUN rm -rf ./src
# Copy over the actual app
COPY ../backend .
RUN touch -a -m ./src/main.rs # Modify access/modify time so it gets rebuild after cache
# RUN cargo test # --release .
RUN cargo install --path . --debug
# ---------------------------------------------------------------------------
# FRONTEND
# ---------------------------------------------------------------------------
# FROM node:latest AS builder_fe
# WORKDIR /frontend
# # Dependencies
# COPY ../frontend/package.json .
# COPY ../frontend/package-lock.json .
# RUN npm i
# # Actual Code
# COPY ../frontend .
# RUN npm run build
# ---------------------------------------------------------------------------
# APP
# ---------------------------------------------------------------------------
FROM debian:bullseye
RUN apt-get update && apt-get install -y curl libuv1 libssl1.1
RUN curl -o cassandra-cpp-driver.deb https://downloads.datastax.com/cpp-driver/ubuntu/18.04/cassandra/v2.16.0/cassandra-cpp-driver_2.16.0-1_amd64.deb
RUN dpkg --ignore-depends=multiarch-support -i cassandra-cpp-driver.deb && rm cassandra-cpp-driver.deb
COPY --from=builder_be /usr/local/cargo/bin/backend /usr/local/bin/backend
# COPY --from=builder_fe /frontend/dist /srv/evaluation/frontend
ENTRYPOINT ["backend"]