pre-deploy commit
This commit is contained in:
25
Dockerfile
25
Dockerfile
@@ -8,11 +8,12 @@ WORKDIR /app
|
||||
COPY package*.json ./
|
||||
COPY tsconfig.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm ci --only=production && npm cache clean --force
|
||||
# Install all dependencies (including devDependencies for build)
|
||||
RUN npm ci && npm cache clean --force
|
||||
|
||||
# Copy source code
|
||||
COPY src/ ./src/
|
||||
COPY .env.example ./
|
||||
|
||||
# Build the application
|
||||
RUN npm run build
|
||||
@@ -31,11 +32,19 @@ RUN npm ci --only=production && npm cache clean --force
|
||||
|
||||
# Copy built application from builder stage
|
||||
COPY --from=builder /app/dist ./dist
|
||||
COPY --from=builder /app/.env.example ./.env.example
|
||||
|
||||
# Copy configuration files
|
||||
COPY config/ ./config/
|
||||
# Copy database migrations
|
||||
COPY src/database/migrations/ ./dist/database/migrations/
|
||||
|
||||
# Create uploads directory
|
||||
# Copy locales
|
||||
COPY src/locales/ ./dist/locales/
|
||||
|
||||
# Copy scripts
|
||||
COPY scripts/startup.sh ./startup.sh
|
||||
RUN chmod +x ./startup.sh
|
||||
|
||||
# Create directories
|
||||
RUN mkdir -p uploads logs
|
||||
|
||||
# Create non-root user for security
|
||||
@@ -53,7 +62,7 @@ EXPOSE 3000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD node -e "require('http').get('http://localhost:3000/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })" || exit 1
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
|
||||
|
||||
# Start the application
|
||||
CMD ["node", "dist/bot.js"]
|
||||
# Start the application with migration script
|
||||
CMD ["./startup.sh"]
|
||||
|
||||
Reference in New Issue
Block a user