- Full-stack Node.js/Express application with PostgreSQL - Modern ES modules architecture - AdminJS admin panel with Sequelize ORM - Tourism routes, guides, articles, bookings management - Responsive Bootstrap 5 frontend - Docker containerization with docker-compose - Complete database schema with migrations - Authentication system for admin panel - Dynamic placeholder images for tour categories
44 lines
913 B
Docker
44 lines
913 B
Docker
FROM node:18-alpine AS builder
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci --only=production
|
|
|
|
# Copy application files
|
|
COPY . .
|
|
|
|
# Remove development files
|
|
RUN rm -rf .git .gitignore docker-compose.yml Dockerfile README.md
|
|
|
|
# Final stage
|
|
FROM node:18-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Create non-root user
|
|
RUN addgroup -g 1001 -S nodejs
|
|
RUN adduser -S tourism -u 1001
|
|
|
|
# Copy from builder
|
|
COPY --from=builder --chown=tourism:nodejs /app .
|
|
|
|
# Create uploads directory
|
|
RUN mkdir -p public/uploads && chown tourism:nodejs public/uploads
|
|
|
|
# Switch to non-root user
|
|
USER tourism
|
|
|
|
# Expose port
|
|
EXPOSE 3000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD node -e "require('http').get('http://localhost:3000', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })"
|
|
|
|
# Start application
|
|
CMD ["npm", "start"] |