File size: 834 Bytes
340c655 7098d62 340c655 7098d62 340c655 7098d62 340c655 5cd4cea 7098d62 340c655 dd10bc0 7098d62 340c655 7098d62 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # Base Node.js image
FROM node:18-alpine
# Set working directory
WORKDIR /app
# Install necessary tools (git, bash, etc.)
RUN apk add --no-cache git bash
# Copy application files to container
COPY . .
# Install dependencies
RUN yarn install
# Set permissions for users.json and users directory
RUN touch users.json && \
chmod 666 users.json && \
mkdir -p users && \
chmod 777 users
# Ensure start.sh is executable
RUN chmod +x start.sh
# Create a non-root user and switch to it
RUN adduser -D appuser
USER appuser
# Expose application port
EXPOSE 7860
# Set default environment variables
ENV NODE_ENV=production
ENV PORT=7860
# Healthcheck to ensure app is running
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s CMD curl -f http://localhost:7860 || exit 1
# Run start script
CMD ["sh", "./start.sh"] |