Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +16 -13
Dockerfile
CHANGED
|
@@ -1,28 +1,31 @@
|
|
| 1 |
-
# 1. Use Node 18 (Alpine)
|
| 2 |
FROM node:18-alpine
|
| 3 |
|
| 4 |
-
#
|
|
|
|
|
|
|
|
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
#
|
| 8 |
RUN apk add --no-cache git
|
| 9 |
|
| 10 |
-
#
|
| 11 |
COPY . /app
|
| 12 |
|
| 13 |
-
#
|
| 14 |
RUN npm install
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
# If Showdown has a "build" script, run it here.
|
| 18 |
-
# In the official repo, there's a `build` script that compiles TS -> JS:
|
| 19 |
RUN npm run build
|
| 20 |
|
| 21 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
EXPOSE 8000
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
# If Showdown is built into "dist", you might do:
|
| 26 |
-
# CMD ["node", "dist/pokemon-showdown", "start"]
|
| 27 |
-
# Otherwise, if the original scripts remain, it might be:
|
| 28 |
CMD ["node", "pokemon-showdown", "start"]
|
|
|
|
|
|
|
| 1 |
FROM node:18-alpine
|
| 2 |
|
| 3 |
+
# Create a non-root user (optional but recommended)
|
| 4 |
+
RUN adduser -D showdown
|
| 5 |
+
|
| 6 |
+
# Create and use /app as the working directory
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
+
# Install Git if needed
|
| 10 |
RUN apk add --no-cache git
|
| 11 |
|
| 12 |
+
# Copy code from your local machine into the container
|
| 13 |
COPY . /app
|
| 14 |
|
| 15 |
+
# Install dependencies
|
| 16 |
RUN npm install
|
| 17 |
|
| 18 |
+
# Build the TS → JS so that runtime doesn't need to compile again
|
|
|
|
|
|
|
| 19 |
RUN npm run build
|
| 20 |
|
| 21 |
+
# Make sure the showdown user owns all files
|
| 22 |
+
RUN chown -R showdown:showdown /app
|
| 23 |
+
|
| 24 |
+
# Switch to the showdown user
|
| 25 |
+
USER showdown
|
| 26 |
+
|
| 27 |
+
# Expose default port
|
| 28 |
EXPOSE 8000
|
| 29 |
|
| 30 |
+
# Finally, launch the server
|
|
|
|
|
|
|
|
|
|
| 31 |
CMD ["node", "pokemon-showdown", "start"]
|