build: streamline Docker setup and environment config
- Simplify Dockerfile to use official Bun image as base - Add admin bootstrap environment variables to .env.example - Include VITE_ADMIN_EMAIL and VITE_ADMIN_PASSWORD build args - Fix newline at end of .env.example file - Remove redundant system dependency installations
This commit is contained in:
@@ -20,6 +20,12 @@ VITE_COUCHDB_URL=http://localhost:5984
|
||||
VITE_COUCHDB_USER=admin
|
||||
VITE_COUCHDB_PASSWORD=change-this-secure-password
|
||||
|
||||
# Default Admin Bootstrap (used by frontend seeder at startup)
|
||||
# Note: These are evaluated at build-time by Vite. If you change them,
|
||||
# rebuild the frontend image (`docker compose build frontend`).
|
||||
VITE_ADMIN_EMAIL=admin@localhost
|
||||
VITE_ADMIN_PASSWORD=admin123!
|
||||
|
||||
# Application Configuration
|
||||
# Base URL for your application (used in email links)
|
||||
# Development: http://localhost:5173
|
||||
@@ -85,4 +91,4 @@ GITEA_REPOSITORY=yourusername/rxminder
|
||||
DEPLOYMENT_WEBHOOK_URL=
|
||||
|
||||
# Image cleanup settings
|
||||
CLEANUP_OLD_IMAGES=true
|
||||
CLEANUP_OLD_IMAGES=true
|
||||
|
||||
28
Dockerfile
28
Dockerfile
@@ -1,34 +1,17 @@
|
||||
# Multi-stage Dockerfile for Medication Reminder App
|
||||
FROM node:20-slim AS base
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
unzip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Bun
|
||||
RUN curl -fsSL https://bun.sh/install | bash
|
||||
ENV PATH="/root/.bun/bin:$PATH"
|
||||
FROM oven/bun:1 AS builder
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Create non-root user
|
||||
RUN groupadd --gid 1001 nodeuser && \
|
||||
useradd --uid 1001 --gid nodeuser --shell /bin/bash --create-home nodeuser
|
||||
|
||||
# Builder stage
|
||||
FROM base AS builder
|
||||
|
||||
# Copy package files
|
||||
COPY --chown=nodeuser:nodeuser package.json bun.lock* ./
|
||||
COPY package.json bun.lock* ./
|
||||
|
||||
# Install dependencies
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
# Copy source code
|
||||
COPY --chown=nodeuser:nodeuser . ./
|
||||
COPY . ./
|
||||
|
||||
# Build arguments for environment configuration
|
||||
# Build Environment - unified config will handle the rest
|
||||
@@ -40,6 +23,8 @@ ARG NODE_ENV=production
|
||||
ARG VITE_COUCHDB_URL
|
||||
ARG VITE_COUCHDB_USER
|
||||
ARG VITE_COUCHDB_PASSWORD
|
||||
ARG VITE_ADMIN_EMAIL
|
||||
ARG VITE_ADMIN_PASSWORD
|
||||
|
||||
# Set environment variables for build process
|
||||
# Unified config handles defaults, only set essential runtime overrides
|
||||
@@ -47,7 +32,8 @@ ENV NODE_ENV=$NODE_ENV
|
||||
ENV VITE_COUCHDB_URL=$VITE_COUCHDB_URL
|
||||
ENV VITE_COUCHDB_USER=$VITE_COUCHDB_USER
|
||||
ENV VITE_COUCHDB_PASSWORD=$VITE_COUCHDB_PASSWORD
|
||||
ENV NODE_ENV=$NODE_ENV
|
||||
ENV VITE_ADMIN_EMAIL=$VITE_ADMIN_EMAIL
|
||||
ENV VITE_ADMIN_PASSWORD=$VITE_ADMIN_PASSWORD
|
||||
|
||||
# Build the application
|
||||
RUN bun run build
|
||||
|
||||
Reference in New Issue
Block a user