first pass
This commit is contained in:
47
templates/nodejs/express/.dockerignore.template
Normal file
47
templates/nodejs/express/.dockerignore.template
Normal file
@@ -0,0 +1,47 @@
|
||||
node_modules
|
||||
npm-debug.log*
|
||||
.git
|
||||
.gitignore
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
*.tar
|
||||
*.tar.gz
|
||||
|
||||
# IDE
|
||||
.vscode
|
||||
.idea
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# Test & Coverage
|
||||
coverage
|
||||
.nyc_output
|
||||
*.test.js
|
||||
*.spec.js
|
||||
__tests__
|
||||
|
||||
# Build artifacts
|
||||
dist
|
||||
build
|
||||
|
||||
# Documentation
|
||||
README.md
|
||||
README.DOCKER.md
|
||||
CHANGELOG.md
|
||||
docs
|
||||
|
||||
# Docker files (don't include in image)
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
docker-compose.yaml
|
||||
.dockerignore
|
||||
docker-deployment.json
|
||||
|
||||
# Scripts
|
||||
*.ps1
|
||||
*.sh
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
27
templates/nodejs/express/Dockerfile.template
Normal file
27
templates/nodejs/express/Dockerfile.template
Normal file
@@ -0,0 +1,27 @@
|
||||
FROM node:{{NODE_VERSION}}-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files first for better caching
|
||||
COPY package.json package-lock.json* ./
|
||||
|
||||
# Install production dependencies only
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
# Copy application source
|
||||
COPY . .
|
||||
|
||||
# Set environment
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT={{PORT}}
|
||||
|
||||
{{#if BUILD_COMMAND}}
|
||||
# Build application
|
||||
RUN {{BUILD_COMMAND}}
|
||||
{{/if}}
|
||||
|
||||
# Expose port
|
||||
EXPOSE {{PORT}}
|
||||
|
||||
# Start application
|
||||
CMD ["node", "{{ENTRY_POINT}}"]
|
||||
24
templates/nodejs/express/docker-compose.yml.template
Normal file
24
templates/nodejs/express/docker-compose.yml.template
Normal file
@@ -0,0 +1,24 @@
|
||||
services:
|
||||
{{PROJECT_NAME}}:
|
||||
build: .
|
||||
container_name: {{PROJECT_NAME}}
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${HOST_PORT:-{{PORT}}}:{{PORT}}"
|
||||
{{#if USE_ENV_FILE}}
|
||||
env_file:
|
||||
- .env
|
||||
{{/if}}
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
PORT: {{PORT}}
|
||||
{{#if HAS_VOLUMES}}
|
||||
volumes:
|
||||
{{#each VOLUMES}}
|
||||
- {{this}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
{{#if EXTRA_HOSTS}}
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
{{/if}}
|
||||
Reference in New Issue
Block a user