mirror of
https://github.com/Xevion/banner.git
synced 2025-12-05 23:14:20 -06:00
feat: setup frontend build code, tune .dockerignore patterns
also removed diesel.toml
This commit is contained in:
@@ -2,72 +2,22 @@
|
||||
target/
|
||||
**/target/
|
||||
|
||||
# Development files
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# IDE and editor files
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# OS generated files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Git
|
||||
.git/
|
||||
.gitignore
|
||||
|
||||
# Documentation
|
||||
README.md
|
||||
docs/
|
||||
*.md
|
||||
|
||||
# Go files (since this is a Rust project)
|
||||
# Old Go codebase
|
||||
go/
|
||||
|
||||
# Database migrations (if not needed at runtime)
|
||||
migrations/
|
||||
diesel_migrations/
|
||||
diesel.toml
|
||||
|
||||
# Development configuration
|
||||
bacon.toml
|
||||
.cargo/config.toml
|
||||
.env
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
logs/
|
||||
|
||||
# Temporary files
|
||||
tmp/
|
||||
temp/
|
||||
*.tmp
|
||||
|
||||
# Test files
|
||||
tests/
|
||||
**/tests/
|
||||
*_test.rs
|
||||
*_tests.rs
|
||||
|
||||
# Coverage reports
|
||||
coverage/
|
||||
*.gcov
|
||||
*.gcno
|
||||
*.gcda
|
||||
|
||||
# Profiling
|
||||
*.prof
|
||||
|
||||
# Backup files
|
||||
*.bak
|
||||
*.backup
|
||||
# Frontend build artifacts and cache
|
||||
web/node_modules/
|
||||
web/dist/
|
||||
web/.vite/
|
||||
web/.tanstack/
|
||||
web/.vscode/
|
||||
.vscode/
|
||||
|
||||
36
Dockerfile
36
Dockerfile
@@ -1,5 +1,27 @@
|
||||
# Build Stage
|
||||
# Build arguments
|
||||
ARG RUST_VERSION=1.89.0
|
||||
|
||||
# Frontend Build Stage
|
||||
FROM node:22-bookworm-slim AS frontend-builder
|
||||
|
||||
# Install pnpm
|
||||
RUN npm install -g pnpm
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy frontend package files
|
||||
COPY ./web/package.json ./web/pnpm-lock.yaml ./
|
||||
|
||||
# Install dependencies
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Copy frontend source code
|
||||
COPY ./web ./
|
||||
|
||||
# Build frontend
|
||||
RUN pnpm run build
|
||||
|
||||
# Rust Build Stage
|
||||
FROM rust:${RUST_VERSION}-bookworm AS builder
|
||||
|
||||
# Install build dependencies
|
||||
@@ -18,9 +40,14 @@ COPY ./Cargo.toml ./Cargo.lock* ./
|
||||
# Build empty app with downloaded dependencies to produce a stable image layer for next build
|
||||
RUN cargo build --release
|
||||
|
||||
# Build web app with own code
|
||||
# Copy source code
|
||||
RUN rm src/*.rs
|
||||
COPY ./src ./src
|
||||
|
||||
# Copy built frontend assets
|
||||
COPY --from=frontend-builder /app/dist ./web/dist
|
||||
|
||||
# Build web app with embedded assets
|
||||
RUN rm ./target/release/deps/banner*
|
||||
RUN cargo build --release
|
||||
|
||||
@@ -50,7 +77,7 @@ RUN addgroup --gid $GID $APP_USER \
|
||||
&& adduser --uid $UID --disabled-password --gecos "" --ingroup $APP_USER $APP_USER \
|
||||
&& mkdir -p ${APP}
|
||||
|
||||
# Copy application files
|
||||
# Copy application binary
|
||||
COPY --from=builder --chown=$APP_USER:$APP_USER /usr/src/banner/target/release/banner ${APP}/banner
|
||||
|
||||
# Set proper permissions
|
||||
@@ -73,4 +100,5 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
ENV HOSTS=0.0.0.0,[::]
|
||||
|
||||
# Implicitly uses PORT environment variable
|
||||
CMD ["sh", "-c", "exec ./banner --server ${HOSTS}"]
|
||||
# temporary: running without 'scraper' service
|
||||
CMD ["sh", "-c", "exec ./banner --services web,bot"]
|
||||
@@ -1,9 +0,0 @@
|
||||
# For documentation on how to configure this file,
|
||||
# see https://diesel.rs/guides/configuring-diesel-cli
|
||||
|
||||
[print_schema]
|
||||
file = "src/data/schema.rs"
|
||||
custom_type_derives = ["diesel::query_builder::QueryId", "Clone"]
|
||||
|
||||
[migrations_directory]
|
||||
dir = "migrations"
|
||||
Reference in New Issue
Block a user