File size: 1,340 Bytes
2af848d
 
05f7084
2af848d
 
05f7084
 
 
 
2af848d
05f7084
2af848d
 
05f7084
 
 
2af848d
 
05f7084
 
 
 
2af848d
05f7084
2af848d
 
 
 
05f7084
 
2af848d
05f7084
2af848d
 
 
 
 
05f7084
 
 
 
 
 
 
 
2af848d
05f7084
 
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
FROM nikolaik/python-nodejs:python3.10-nodejs18

# Install necessary packages, including xvfb
USER root

RUN apt-get -y update && \
    apt-get install -y nginx libglu1 xvfb libxcursor1 ca-certificates && \
    apt-get clean && \
    update-ca-certificates

# Create necessary directories and set permissions for 'pn'
RUN mkdir -p /var/cache/nginx \
             /var/log/nginx \
             /var/lib/nginx \
             /var/run/nginx.pid \
             /home/pn/app/build

RUN chown -R pn:pn /var/cache/nginx \
                   /var/log/nginx \
                   /var/lib/nginx \
                   /var/run/nginx.pid \
                   /home/pn/app/build

# Switch to non-root user 'pn'
USER pn
ENV HOME=/home/pn \
    PATH=/home/pn/.local/bin:$PATH

# Set the working directory to /home/pn/app
WORKDIR /home/pn/app

# Copy Python dependencies, Nginx configuration, and application code
COPY --chown=pn requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

COPY --chown=pn nginx.conf /etc/nginx/sites-available/default

# Copy Unity game server build
COPY --chown=pn build/ /home/pn/app/build/

# Copy the run script
COPY --chown=pn run.sh /home/pn/app/

# Ensure the Unity server binary is executable
RUN chmod +x /home/pn/app/build/linuxBuild.x86_64

# Run the application
CMD ["bash", "run.sh"]