parent
937b3fc811
commit
f3a61bfa99
21 changed files with 55 additions and 1071 deletions
51
Dockerfile
51
Dockerfile
|
@ -1,29 +1,5 @@
|
|||
# Frontend build stage
|
||||
FROM oven/bun:latest as frontend-builder
|
||||
WORKDIR /app/frontend
|
||||
|
||||
# Install bun
|
||||
RUN curl -fsSL https://bun.sh/install | bash
|
||||
ENV PATH="/root/.bun/bin:${PATH}"
|
||||
|
||||
# Copy frontend files
|
||||
COPY frontend/package.json frontend/bun.lock ./
|
||||
RUN bun install
|
||||
|
||||
COPY frontend/ ./
|
||||
|
||||
# Build frontend with environment variables
|
||||
# These can be overridden at build time
|
||||
ARG VITE_API_URL=http://localhost:3000
|
||||
ARG NODE_ENV=production
|
||||
ENV VITE_API_URL=$VITE_API_URL
|
||||
ENV NODE_ENV=$NODE_ENV
|
||||
|
||||
RUN echo "VITE_API_URL=${VITE_API_URL}" > .env.production
|
||||
RUN bun run build
|
||||
|
||||
# Rust build stage
|
||||
FROM rust:latest as backend-builder
|
||||
# Build stage
|
||||
FROM rust:latest as builder
|
||||
|
||||
# Install PostgreSQL client libraries and SSL dependencies
|
||||
RUN apt-get update && \
|
||||
|
@ -40,9 +16,8 @@ COPY src/ src/
|
|||
COPY migrations/ migrations/
|
||||
COPY .sqlx/ .sqlx/
|
||||
|
||||
# Build application
|
||||
ARG RUST_ENV=release
|
||||
RUN cargo build --${RUST_ENV}
|
||||
# Build your application
|
||||
RUN cargo build --release
|
||||
|
||||
# Runtime stage
|
||||
FROM debian:bookworm-slim
|
||||
|
@ -54,19 +29,17 @@ RUN apt-get update && \
|
|||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the binary and migrations from backend builder
|
||||
COPY --from=backend-builder /usr/src/app/target/release/simplelink /app/simplelink
|
||||
COPY --from=backend-builder /usr/src/app/migrations /app/migrations
|
||||
# Copy the binary from builder
|
||||
COPY --from=builder /usr/src/app/target/release/simplelink /app/simplelink
|
||||
# Copy migrations folder for SQLx
|
||||
COPY --from=builder /usr/src/app/migrations /app/migrations
|
||||
|
||||
# Copy static files from frontend builder
|
||||
COPY --from=frontend-builder /app/frontend/dist /app/static
|
||||
|
||||
# Expose the port
|
||||
EXPOSE 3000
|
||||
# Expose the port (this is just documentation)
|
||||
EXPOSE 8080
|
||||
|
||||
# Set default network configuration
|
||||
ENV SERVER_HOST=0.0.0.0
|
||||
ENV SERVER_PORT=3000
|
||||
ENV SERVER_PORT=8080
|
||||
|
||||
# Run the binary
|
||||
CMD ["./simplelink"]
|
||||
CMD ["./simplelink"]
|
Loading…
Add table
Add a link
Reference in a new issue