Update Dockerfile
Browse files- Dockerfile +42 -22
Dockerfile
CHANGED
@@ -1,29 +1,49 @@
|
|
1 |
-
#
|
2 |
-
FROM
|
3 |
|
4 |
-
#
|
5 |
-
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
libxrender1 \
|
12 |
-
libxext6 \
|
13 |
-
xvfb \
|
14 |
-
&& rm -rf /var/lib/apt/lists/*
|
15 |
|
16 |
-
# Create
|
17 |
-
RUN mkdir /
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
21 |
|
22 |
-
#
|
23 |
-
|
|
|
|
|
24 |
|
25 |
-
#
|
26 |
-
|
27 |
|
28 |
-
#
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"]
|