Clone04 commited on
Commit
05f7084
1 Parent(s): c4fdc5d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -18
Dockerfile CHANGED
@@ -1,39 +1,48 @@
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
  FROM nikolaik/python-nodejs:python3.10-nodejs18
2
 
3
+ # Install necessary packages, including xvfb
 
4
  USER root
5
 
6
+ RUN apt-get -y update && \
7
+ apt-get install -y nginx libglu1 xvfb libxcursor1 ca-certificates && \
8
+ apt-get clean && \
9
+ update-ca-certificates
10
 
11
+ # Create necessary directories and set permissions for 'pn'
12
  RUN mkdir -p /var/cache/nginx \
13
  /var/log/nginx \
14
+ /var/lib/nginx \
15
+ /var/run/nginx.pid \
16
+ /home/pn/app/build
17
 
18
  RUN chown -R pn:pn /var/cache/nginx \
19
+ /var/log/nginx \
20
+ /var/lib/nginx \
21
+ /var/run/nginx.pid \
22
+ /home/pn/app/build
23
 
24
+ # Switch to non-root user 'pn'
25
  USER pn
26
  ENV HOME=/home/pn \
27
  PATH=/home/pn/.local/bin:$PATH
28
 
29
+ # Set the working directory to /home/pn/app
30
+ WORKDIR /home/pn/app
 
31
 
32
+ # Copy Python dependencies, Nginx configuration, and application code
33
  COPY --chown=pn requirements.txt requirements.txt
34
  RUN pip install --no-cache-dir -r requirements.txt
35
 
 
36
  COPY --chown=pn nginx.conf /etc/nginx/sites-available/default
37
 
38
+ # Copy Unity game server build
39
+ COPY --chown=pn build/ /home/pn/app/build/
40
+
41
+ # Copy the run script
42
+ COPY --chown=pn run.sh /home/pn/app/
43
+
44
+ # Ensure the Unity server binary is executable
45
+ RUN chmod +x /home/pn/app/build/linuxBuild.x86_64
46
 
47
+ # Run the application
48
+ CMD ["bash", "run.sh"]