-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (36 loc) · 1.08 KB
/
Dockerfile
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
41
42
43
44
45
46
47
# Use the official Python image from Docker Hub
FROM python:3.12-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set the working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
cron \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements file and install dependencies
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
# Copy the Django project files into the container
COPY . .
# Create a directory for the SQLite database
RUN mkdir -p /data
VOLUME ["/data"]
# Set environment variable for database path
ENV SQLITE_PATH=/data/db.sqlite3
# Setup cron job
COPY cron/update /etc/cron.d/update
RUN chmod 0644 /etc/cron.d/update
# Apply cron job
RUN crontab /etc/cron.d/update
# Create the log file to be able to run tail
RUN touch /var/log/cron.log
# Make the start.sh script executable
RUN chmod +x /app/start.sh
# Expose the port used by the application
EXPOSE 8000
# Start the application using the start.sh script
CMD ["/app/start.sh"]