Skip to content

Commit

Permalink
completed dev/prod setup
Browse files Browse the repository at this point in the history
  • Loading branch information
bgorman87 committed Jul 19, 2024
1 parent 8c74e91 commit c60f394
Show file tree
Hide file tree
Showing 22 changed files with 814 additions and 34 deletions.
9 changes: 9 additions & 0 deletions .env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DATABASE_USER=postgres
DATABASE_PASSWORD=password
DATABASE_NAME=database
DATABASE_PORT=5432
DATABASE_HOST=db
SITE_URL=http://localhost:3000
BACKEND_PORT=8000
FRONTEND_PORT=3000
BACKEND_HOST=express-app
134 changes: 132 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,132 @@
devAssets
**/node_modules
# Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Logs
logs/
*.log
*.log.*

# Runtime data
pids/
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov/

# Coverage directory used by tools like istanbul
coverage/

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt/

# Bower dependency directory (https://bower.io/)
bower_components/

# Dependency directories
frontend/node_modules/
backend/node_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm/

# Optional eslint cache
.eslintcache/

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# dotenv environment variables files for specific environments
.env.local
.env.development.local
.env.test.local
.env.production.local

# Environment variable files
backend/.env
frontend/.env

# Build artifacts
frontend/build/
frontend/dist/
backend/build/
backend/dist/

# Mac system files
.DS_Store

# Thumbnails
._*

# Files that might appear on the root of a volume
.AppleDouble
.LSOverride

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# IDEs and editors
.idea/
.vscode/
*.sublime-project
*.sublime-workspace

# IntelliJ
*.iml
*.ipr
*.iws
.idea/

# VSCode
.vscode/
.history/

# Eclipse
.project
.cproject
.settings/
.loadpath

# WebStorm
.idea/

# NetBeans
.nb-configuration.xml

# SFTP Sublime
sftp-config.json
sftp-settings.json

# VSCode settings
.vscode/

# Exclude the generated folders by Create React App
frontend/.cache/
frontend/.parcel-cache/

# Exclude Next.js build output
.next/

# Exclude Gatsby build output
.cache/
public/

# Nuxt.js build output
.nuxt/
32 changes: 32 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Node modules
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Logs
logs/
*.log
*.log.*

# Runtime data
pids/
*.pid
*.seed
*.pid.lock

# Build artifacts
build/
dist/

# dotenv environment variables file
.env

# IDE and editor files
.vscode/
.idea/
*.sublime-project
*.sublime-workspace

# Other system files
.DS_Store
11 changes: 8 additions & 3 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ FROM node:22.4.0

WORKDIR /usr/src/app

COPY package*.json ./
ARG BACKEND_PORT

ENV BACKEND_PORT=$BACKEND_PORT

COPY package*.json ./
RUN npm install

COPY . .

EXPOSE 3000
RUN if [ "$NODE_ENV" = "production" ]; then npm run build; fi

EXPOSE $BACKEND_PORT

CMD ["npm", "start"]
CMD ["npm", "run", "dev"]
Loading

0 comments on commit c60f394

Please sign in to comment.