mirror of
https://github.com/eliasrenman/url-shortener.git
synced 2026-03-16 20:16:06 +01:00
32 lines
561 B
Docker
32 lines
561 B
Docker
# Stage 1: Build the frontend assets using Bun
|
|
FROM oven/bun:1-alpine AS bun-builder
|
|
|
|
# Set the working directory
|
|
WORKDIR /app/web
|
|
|
|
# Copy the frontend source code
|
|
COPY ./web ./
|
|
|
|
# Install dependencies and build the frontend
|
|
RUN bun install --frozen-lockfile && bun run build
|
|
|
|
# Build binaries
|
|
FROM rust:slim
|
|
|
|
RUN apt update && \
|
|
apt install -y libsqlite3-dev
|
|
COPY --from=bun-builder /app/web/dist ./web/dist
|
|
|
|
WORKDIR /app
|
|
|
|
COPY . .
|
|
|
|
RUN cargo build --release
|
|
|
|
ENV ROCKET_ADDRESS=0.0.0.0
|
|
ENV ROCKET_PORT=8000
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD [ "cargo", "run", "--release" ]
|