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_USER=admin
|
||||||
VITE_COUCHDB_PASSWORD=change-this-secure-password
|
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
|
# Application Configuration
|
||||||
# Base URL for your application (used in email links)
|
# Base URL for your application (used in email links)
|
||||||
# Development: http://localhost:5173
|
# Development: http://localhost:5173
|
||||||
|
|||||||
28
Dockerfile
28
Dockerfile
@@ -1,34 +1,17 @@
|
|||||||
# Multi-stage Dockerfile for Medication Reminder App
|
# Multi-stage Dockerfile for Medication Reminder App
|
||||||
FROM node:20-slim AS base
|
FROM oven/bun:1 AS builder
|
||||||
|
|
||||||
# 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"
|
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
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 package files
|
||||||
COPY --chown=nodeuser:nodeuser package.json bun.lock* ./
|
COPY package.json bun.lock* ./
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN bun install --frozen-lockfile
|
RUN bun install --frozen-lockfile
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code
|
||||||
COPY --chown=nodeuser:nodeuser . ./
|
COPY . ./
|
||||||
|
|
||||||
# Build arguments for environment configuration
|
# Build arguments for environment configuration
|
||||||
# Build Environment - unified config will handle the rest
|
# Build Environment - unified config will handle the rest
|
||||||
@@ -40,6 +23,8 @@ ARG NODE_ENV=production
|
|||||||
ARG VITE_COUCHDB_URL
|
ARG VITE_COUCHDB_URL
|
||||||
ARG VITE_COUCHDB_USER
|
ARG VITE_COUCHDB_USER
|
||||||
ARG VITE_COUCHDB_PASSWORD
|
ARG VITE_COUCHDB_PASSWORD
|
||||||
|
ARG VITE_ADMIN_EMAIL
|
||||||
|
ARG VITE_ADMIN_PASSWORD
|
||||||
|
|
||||||
# Set environment variables for build process
|
# Set environment variables for build process
|
||||||
# Unified config handles defaults, only set essential runtime overrides
|
# 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_URL=$VITE_COUCHDB_URL
|
||||||
ENV VITE_COUCHDB_USER=$VITE_COUCHDB_USER
|
ENV VITE_COUCHDB_USER=$VITE_COUCHDB_USER
|
||||||
ENV VITE_COUCHDB_PASSWORD=$VITE_COUCHDB_PASSWORD
|
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
|
# Build the application
|
||||||
RUN bun run build
|
RUN bun run build
|
||||||
|
|||||||
Reference in New Issue
Block a user