clone3 commited on
Commit
4d1c3a3
·
verified ·
1 Parent(s): 09e8d4f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +42 -22
Dockerfile CHANGED
@@ -1,29 +1,49 @@
1
- # Use a base image with necessary dependencies
2
- FROM ubuntu:20.04
3
 
4
- # Set environment variables to avoid user interaction during installation
5
- ENV DEBIAN_FRONTEND=noninteractive
6
 
7
- # Update package list and install necessary dependencies
8
- RUN apt-get update && apt-get install -y \
9
- libglib2.0-0 \
10
- libsm6 \
11
- libxrender1 \
12
- libxext6 \
13
- xvfb \
14
- && rm -rf /var/lib/apt/lists/*
15
 
16
- # Create a directory for the server build
17
- RUN mkdir /server
 
 
 
 
18
 
19
- # Copy the server build files into the container
20
- COPY ServerBuild /server
 
 
 
21
 
22
- # Make the server executable executable
23
- RUN chmod +x /server/ServerBuild.x86_64
 
 
24
 
25
- # Expose port 7860 for communication
26
- EXPOSE 7860
27
 
28
- # Run the server build using xvfb-run to handle graphics (if needed)
29
- CMD ["xvfb-run", "/server/ServerBuild.x86_64"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Base image with Python and Node.js
2
+ FROM nikolaik/python-nodejs:python3.10-nodejs18
3
 
4
+ # Install necessary packages, Nginx, and dependencies for Unity game server
5
+ USER root
6
 
7
+ RUN apt-get -y update && \
8
+ apt-get install -y nginx libglu1 xvfb libxcursor1 ca-certificates && \
9
+ apt-get clean && \
10
+ update-ca-certificates
 
 
 
 
11
 
12
+ # Create necessary directories and set permissions for 'pn'
13
+ RUN mkdir -p /var/cache/nginx \
14
+ /var/log/nginx \
15
+ /var/lib/nginx \
16
+ /var/run/nginx.pid \
17
+ /home/pn/app/build
18
 
19
+ RUN chown -R pn:pn /var/cache/nginx \
20
+ /var/log/nginx \
21
+ /var/lib/nginx \
22
+ /var/run/nginx.pid \
23
+ /home/pn/app/build
24
 
25
+ # Switch to non-root user 'pn'
26
+ USER pn
27
+ ENV HOME=/home/pn \
28
+ PATH=/home/pn/.local/bin:$PATH
29
 
30
+ # Set the working directory to /home/pn/app
31
+ WORKDIR /home/pn/app
32
 
33
+ # Copy Python dependencies, Nginx configuration, and application code
34
+ COPY --chown=pn requirements.txt requirements.txt
35
+ RUN pip install --no-cache-dir -r requirements.txt
36
+
37
+ COPY --chown=pn nginx.conf /etc/nginx/sites-available/default
38
+
39
+ # Copy Unity game server build
40
+ #COPY --chown=pn build/ /home/pn/app/build/
41
+
42
+ # Copy the run script
43
+ COPY --chown=pn run.sh /home/pn/app/
44
+
45
+ # Ensure the Unity server binary is executable
46
+ RUN chmod +x /home/pn/app/build/linuxBuild.x86_64
47
+
48
+ # Run the application
49
+ CMD ["bash", "run.sh"]