mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-01-28 07:28:59 -06:00
44 lines
1.0 KiB
Docker
44 lines
1.0 KiB
Docker
FROM python:3.11-slim
|
|
|
|
# Set environment variables
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV FLASK_APP=app
|
|
ENV FLASK_ENV=production
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set work directory
|
|
WORKDIR /app
|
|
|
|
# Install Python dependencies
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy project
|
|
COPY . .
|
|
|
|
# Create data and logs directories with proper permissions
|
|
RUN mkdir -p /data /app/logs && chmod 755 /data && chmod 755 /app/logs
|
|
|
|
# Make startup scripts executable
|
|
RUN chmod +x /app/docker/start.sh /app/docker/init-database.py /app/docker/test-db.py
|
|
|
|
# Create non-root user
|
|
RUN useradd -m -u 1000 timetracker && \
|
|
chown -R timetracker:timetracker /app /data /app/logs
|
|
USER timetracker
|
|
|
|
# Expose port
|
|
EXPOSE 8080
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
|
CMD curl -f http://localhost:8080/_health || exit 1
|
|
|
|
# Run the application
|
|
CMD ["/app/docker/start.sh"]
|