-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (19 loc) · 742 Bytes
/
Copy pathDockerfile
File metadata and controls
27 lines (19 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Use an official Node image as a base
FROM node:14
# Set working directory
WORKDIR /usr/src/app
# Install Python and Java JDK
RUN apt-get update && apt-get install -y python3 openjdk-11-jdk && apt-get clean
# Copy package.json, package-lock.json, and tsconfig.json before other files
# Utilize Docker cache to save re-installing dependencies if unchanged
COPY package*.json tsconfig.json ./
# Install Node dependencies
RUN npm install
# Install TypeScript globally in the container
RUN npm install -g typescript
# Copy all files from the current directory to the container
COPY . .
# Compile TypeScript to JavaScript
RUN tsc
# Start the server using the compiled JavaScript file from the dist directory
CMD ["node", "dist/index.js"]