Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +4 -19
Dockerfile
CHANGED
|
@@ -1,31 +1,16 @@
|
|
| 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 |
-
|
| 10 |
-
RUN apk add --no-cache git
|
| 11 |
|
| 12 |
-
# Copy code
|
| 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"]
|
|
|
|
| 1 |
FROM node:18-alpine
|
| 2 |
|
|
|
|
| 3 |
RUN adduser -D showdown
|
|
|
|
|
|
|
| 4 |
WORKDIR /app
|
| 5 |
+
RUN chown -R showdown:showdown /app
|
| 6 |
|
| 7 |
+
USER showdown
|
|
|
|
| 8 |
|
| 9 |
+
# Copy code as showdown user so that showdown owns all files
|
| 10 |
+
COPY --chown=showdown:showdown . /app
|
| 11 |
|
|
|
|
| 12 |
RUN npm install
|
|
|
|
|
|
|
| 13 |
RUN npm run build
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
EXPOSE 8000
|
|
|
|
|
|
|
| 16 |
CMD ["node", "pokemon-showdown", "start"]
|