Clone04 commited on
Commit
79a511f
·
verified ·
1 Parent(s): 07fae21

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -18
Dockerfile CHANGED
@@ -1,39 +1,49 @@
1
- # See https://hub.docker.com/r/nikolaik/python-nodejs
2
- # https://github.com/nikolaik/docker-python-nodejs
3
- # Default user is 'pn' with uid 1000, gid 1000
4
  FROM nikolaik/python-nodejs:python3.10-nodejs18
5
 
6
- # Install nginx and give permissions to 'pn'
7
- # See https://www.rockyourcode.com/run-docker-nginx-as-non-root-user/
8
  USER root
9
 
10
- RUN apt-get -y update && apt-get -y install nginx
 
 
 
11
 
 
12
  RUN mkdir -p /var/cache/nginx \
13
  /var/log/nginx \
14
- /var/lib/nginx
15
- RUN touch /var/run/nginx.pid
 
16
 
17
  RUN chown -R pn:pn /var/cache/nginx \
18
- /var/log/nginx \
19
- /var/lib/nginx \
20
- /var/run/nginx.pid
 
21
 
22
- # Install dependencies and build app as non-root
23
  USER pn
24
  ENV HOME=/home/pn \
25
  PATH=/home/pn/.local/bin:$PATH
26
 
27
- RUN mkdir $HOME/app
28
-
29
- WORKDIR $HOME/app
30
 
 
31
  COPY --chown=pn requirements.txt requirements.txt
32
  RUN pip install --no-cache-dir -r requirements.txt
33
 
34
- # Copy nginx configuration
35
  COPY --chown=pn nginx.conf /etc/nginx/sites-available/default
36
 
37
- COPY --chown=pn . .
 
 
 
 
 
 
 
38
 
39
- CMD ["bash", "run.sh"]
 
 
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"]