yusufgundogdu commited on
Commit
1e9868a
·
verified ·
1 Parent(s): 344a22e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -4
Dockerfile CHANGED
@@ -1,27 +1,50 @@
1
  FROM python:3.9-slim
2
 
 
3
  RUN apt-get update && apt-get install -y \
4
  apache2 \
5
  libapache2-mod-wsgi-py3 \
 
6
  && rm -rf /var/lib/apt/lists/*
7
 
8
- # Log dizinini oluştur ve izinleri ayarla
9
  RUN mkdir -p /var/log/apache2 && \
 
 
10
  chown -R www-data:www-data /var/log/apache2 && \
11
- chmod -R 755 /var/log/apache2
 
 
 
 
12
 
 
 
 
 
 
13
  WORKDIR /var/www/app
14
 
 
15
  COPY app/requirements.txt .
16
  RUN pip install --no-cache-dir -r requirements.txt
17
 
 
18
  COPY apache/apache-config.conf /etc/apache2/sites-available/000-default.conf
19
 
20
- # Apache port configini değiştir
21
- RUN echo "Listen 8080" > /etc/apache2/ports.conf
 
22
 
 
23
  COPY app .
24
 
 
 
 
 
 
25
  EXPOSE 8080
26
 
 
27
  CMD ["apache2ctl", "-D", "FOREGROUND"]
 
1
  FROM python:3.9-slim
2
 
3
+ # Install Apache and required tools
4
  RUN apt-get update && apt-get install -y \
5
  apache2 \
6
  libapache2-mod-wsgi-py3 \
7
+ && apt-get clean \
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
+ # Create necessary directories and set permissions
11
  RUN mkdir -p /var/log/apache2 && \
12
+ mkdir -p /var/lock/apache2 && \
13
+ mkdir -p /var/run/apache2 && \
14
  chown -R www-data:www-data /var/log/apache2 && \
15
+ chown -R www-data:www-data /var/lock/apache2 && \
16
+ chown -R www-data:www-data /var/run/apache2 && \
17
+ chmod -R 775 /var/log/apache2 && \
18
+ chmod -R 775 /var/lock/apache2 && \
19
+ chmod -R 775 /var/run/apache2
20
 
21
+ # Set default port to 8080
22
+ RUN echo "Listen 8080" > /etc/apache2/ports.conf && \
23
+ echo "ServerName localhost" >> /etc/apache2/apache2.conf
24
+
25
+ # Create app directory
26
  WORKDIR /var/www/app
27
 
28
+ # Copy and install requirements
29
  COPY app/requirements.txt .
30
  RUN pip install --no-cache-dir -r requirements.txt
31
 
32
+ # Copy Apache configuration
33
  COPY apache/apache-config.conf /etc/apache2/sites-available/000-default.conf
34
 
35
+ # Enable the site
36
+ RUN a2ensite 000-default && \
37
+ a2dissite default
38
 
39
+ # Copy app code
40
  COPY app .
41
 
42
+ # Set permissions
43
+ RUN chown -R www-data:www-data /var/www/app && \
44
+ chmod -R 755 /var/www/app
45
+
46
+ # Expose port
47
  EXPOSE 8080
48
 
49
+ # Start Apache
50
  CMD ["apache2ctl", "-D", "FOREGROUND"]