Skip to content

Commit 2e5290c

Browse files
committed
WIP App
1 parent 6bc9c5b commit 2e5290c

17 files changed

Lines changed: 407 additions & 730 deletions

.env.example

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1+
# Database Configuration
2+
# User for connecting to the PostgreSQL database.
13
SPARKY_FITNESS_DB_USER=sparky
2-
SPARKY_FITNESS_DB_HOST=localhost
4+
# Name of the database to connect to.
35
SPARKY_FITNESS_DB_NAME=sparkyfitness_db
6+
# Password for the database user.
47
SPARKY_FITNESS_DB_PASSWORD=password
8+
# Port number for the PostgreSQL database server.
59
SPARKY_FITNESS_DB_PORT=5432
610

7-
811
# Logging level for the server. Options: DEBUG, INFO, WARN, ERROR, SILENT
912
SPARKY_FITNESS_LOG_LEVEL=INFO
1013

11-
# AI API Encryption Key (must be 32 bytes long for AES-256)
12-
SPARKY_FITNESS_AI_API_ENCRYPTION_KEY=YOUR_32_BYTE_ENCRYPTION_KEY_HERE
14+
# API Encryption Key (must be 32 bytes long for AES-256)
15+
# Used to encrypt sensitive data like API keys for external services.
16+
# You can generate a strong 32-byte key using:
17+
# node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
18+
SPARKY_FITNESS_API_ENCRYPTION_KEY=7bee6b7620e1d8b4be251c2e50728409299a412c55f46d853eba100b35163428
19+
20+
# JWT Secret for authentication tokens.
21+
# This should be a strong, unique key for securing your application's JWTs.
22+
JWT_SECRET=7bee6b7620e1d8b4be251c2e50728409299a412c55f46d853eba100b35163428
23+
24+
# Port on which the SparkyFitness server will listen.
25+
SPARKY_FITNESS_SERVER_PORT=3010

Dockerfile

Lines changed: 0 additions & 61 deletions
This file was deleted.

Dockerfile.backend

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# syntax=docker/dockerfile:1.4
2+
3+
# Stage 1: Build backend dependencies
4+
FROM node:20-slim AS backend_builder
5+
6+
WORKDIR /app/SparkyFitnessServer
7+
8+
# Copy package.json and package-lock.json for dependency installation
9+
COPY SparkyFitnessServer/package.json SparkyFitnessServer/package-lock.json ./
10+
11+
# Install backend dependencies
12+
RUN npm install
13+
14+
# Stage 2: Runtime container for backend
15+
FROM node:20-slim
16+
17+
WORKDIR /app/SparkyFitnessServer
18+
19+
# Copy installed node_modules from the builder stage
20+
COPY --from=backend_builder /app/SparkyFitnessServer/node_modules ./node_modules
21+
22+
# Copy the rest of the backend application code
23+
COPY SparkyFitnessServer/ .
24+
25+
# Expose the port your backend server listens on
26+
EXPOSE 3010
27+
28+
# Command to run the backend server
29+
CMD ["node", "SparkyFitnessServer.js"]

Dockerfile.frontend

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# syntax=docker/dockerfile:1.4
2+
3+
# Stage 1: Build React frontend
4+
FROM node:20-slim AS builder
5+
6+
ARG VITE_SPARKY_FITNESS_SERVER_HOST
7+
ARG VITE_SPARKY_FITNESS_SERVER_PORT
8+
9+
WORKDIR /app
10+
11+
COPY package.json package-lock.json ./
12+
RUN npm install
13+
14+
COPY . .
15+
16+
RUN npm run build
17+
18+
# Stage 2: Runtime container
19+
FROM node:20-slim
20+
21+
WORKDIR /app
22+
23+
RUN apt-get update && apt-get install -y bash curl nano && rm -rf /var/lib/apt/lists/*
24+
RUN npm install -g serve
25+
26+
COPY --from=builder /app/dist ./dist
27+
28+
EXPOSE 3000
29+
30+
CMD ["sh", "-c", "\
31+
find dist -type f -name '*.js' -print0 | xargs -0 -I {} sed -i \"s|localhost:3010|sparkyfitness-server:3010|g\" {} && \
32+
serve -s dist -l 3000\
33+
"]

0 commit comments

Comments
 (0)