-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
61 lines (44 loc) · 1.42 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Use Python slim image as base
FROM python:3.12-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1
# Set the working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
bash \
nodejs \
npm && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
# Install specific npm version
RUN npm install -g [email protected]
# Copy requirements.txt
COPY ./requirements.txt /app/
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt gunicorn
# Install Node.js dependencies (Tailwind, etc.)
COPY ./package.json /app/
RUN npm install
# Copy project files
COPY . /app/
# Run tailwind build
RUN npm run tw_build
# Change working directory
WORKDIR /app/Algolyzer/
# Migrate database
RUN python manage.py migrate
# Seed the database
RUN python manage.py loaddata data/*
# Collect static files
RUN python manage.py collectstatic --noinput
# Download aiml models (thinking of pushing models to github and everywhere directly)
RUN python manage.py download_models
# Expose port 8000
EXPOSE 8000
# Use production settings instead of default development settings
ENV DJANGO_SETTINGS_MODULE=Algolyzer.settings.production
# Start the application
CMD (celery -A Algolyzer worker --loglevel=info &) && python manage.py create_superuser && gunicorn --bind 0.0.0.0:8000 --access-logfile - --error-logfile - Algolyzer.wsgi:application