Jofthomas commited on
Commit
cf35d12
·
verified ·
1 Parent(s): 581358a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -13
Dockerfile CHANGED
@@ -1,28 +1,31 @@
1
- # 1. Use Node 18 (Alpine)
2
  FROM node:18-alpine
3
 
4
- # 2. Set up our working directory
 
 
 
5
  WORKDIR /app
6
 
7
- # 3. Install any system packages we may need
8
  RUN apk add --no-cache git
9
 
10
- # 4. Copy local files into the container
11
  COPY . /app
12
 
13
- # 5. Install dependencies
14
  RUN npm install
15
 
16
- # 6. Build or transpile, if Pokémon Showdown requires it
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
- # 7. Expose the default port
 
 
 
 
 
 
22
  EXPOSE 8000
23
 
24
- # 8. Start the server
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"]