Skip to content

Commit d9aea1f

Browse files
committed
feat: add NODE_ENV settings and environment config files for production and development
1 parent d967a7a commit d9aea1f

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

.github/workflows/deploy.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,19 @@ jobs:
3838
export NODE_VERSION=$(cat .nvmrc | sed 's/v//')
3939
echo "Using Node version: $NODE_VERSION"
4040
41-
# Create .env.local file with secrets
41+
# Create .env.local file with secrets only
42+
# Public config comes from .env.production (committed to repo)
43+
# NODE_ENV=production is set in docker-compose.yml
4244
cat > .env.local << EOF
4345
DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }}
4446
CLIENT_ID=${{ secrets.CLIENT_ID }}
45-
GUIDES_CHANNEL_ID=${{ secrets.GUIDES_CHANNEL_ID }}
46-
SERVER_ID=${{ secrets.SERVER_ID }}
47-
REPEL_LOG_CHANNEL_ID=${{ secrets.REPEL_LOG_CHANNEL_ID }}
48-
REPEL_ROLE_ID=${{ secrets.REPEL_ROLE_ID }}
49-
MODERATORS_ROLE_IDS=${{ secrets.MODERATORS_ROLE_IDS }}
5047
EOF
5148
5249
# Stop any existing containers
5350
docker compose down || true
5451
5552
# Build and start production container with profile
53+
# NODE_ENV=production is explicitly set in docker-compose.yml bot-prod service
5654
docker compose --profile prod up -d --build
5755
5856
# Check status

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ COPY --from=deps /app/node_modules ./node_modules
4141
COPY --from=build /app/dist ./dist
4242
COPY package.json ./
4343

44+
# Copy environment config files (public, non-secret)
45+
COPY .env.production .env.development ./
46+
4447
# Create data directory and set permissions for node user
4548
RUN mkdir -p /app/data && chown -R node:node /app/data
4649

docker-compose.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ services:
1111
env_file:
1212
- .env.local
1313
environment:
14+
- NODE_ENV=production
1415
- GUIDES_TRACKER_PATH=/app/data/guides-tracker.json
1516
volumes:
1617
# Persist guides tracker data
@@ -30,6 +31,7 @@ services:
3031
env_file:
3132
- .env.local
3233
environment:
34+
- NODE_ENV=development
3335
- GUIDES_TRACKER_PATH=/app/data/guides-tracker.json
3436
volumes:
3537
# Mount source code for hot reload
@@ -40,6 +42,9 @@ services:
4042
# Mount package files (in case dependencies change)
4143
- ./package.json:/app/package.json:ro
4244
- ./pnpm-lock.yaml:/app/pnpm-lock.yaml:ro
45+
# Mount environment config files
46+
- ./.env.development:/app/.env.development:ro
47+
- ./.env.production:/app/.env.production:ro
4348
# Persist guides tracker data
4449
- guides-data:/app/data
4550
profiles:

0 commit comments

Comments
 (0)