File size: 1,499 Bytes
f9dacfc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 official Python 3.11 base image
FROM python:3.11-slim


# Create a non-root user
RUN useradd -ms /bin/bash admin

# Install dependencies and Node.js (18.x)
RUN apt-get update && apt-get upgrade -y && \
    apt-get install -y --no-install-recommends \
        ksh \
        curl \
        nginx \
        gnupg  \
        certbot \
        wkhtmltopdf \
        build-essential \
        libpq-dev \ 
        libssl-dev \
        libffi-dev  \
        python3-dev  \
        libldap2-dev \
        libsasl2-dev \
        python3-certbot-nginx && \
    # Add Node.js 18.x from NodeSource
    curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
    apt-get install -y nodejs && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Print versions (optional debug)
RUN node -v && npm -v && python3 --version && pip3 --version

# Copy application files
#COPY . /app
COPY  odoo.conf requirements.txt /app/

# Copy Angular build files to Nginx web directory
ADD ./odoo.tar /app/odoo

# Set directory permissions
RUN chmod 777 /app

# Set the working directory to /app
WORKDIR /app

# Set ownership and permissions for the app directory
RUN chown -R admin:admin /app && chmod -R 777 /app/*

# Switch to the non-root user for better security
USER admin

# Expose the port the application will run on
EXPOSE 7860

# Install Python dependencies
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt

# Run the Odoo server
CMD ["python3", "odoo/odoo-bin", "-c", "/app/odoo.conf"]