Skip to content

Commit 181c124

Browse files
Add Dockerfile for server backend deployment to Azure
Add a Dockerfile for deploying the server backend to Azure. * **Dockerfile**: - Use `node:20-alpine` as the base image. - Set the working directory to `/app`. - Copy `package.json` and `pnpm-lock.yaml` to the working directory. - Install dependencies using `pnpm install --frozen-lockfile`. - Copy the rest of the application code to the working directory. - Build the application using `pnpm nx build server --verbose`. - Expose port 3000. - Set the command to run the application using `node dist/apps/server/main.js`. * **package.json**: - Add a new script `docker:build` to build the Docker image. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/DeveloperParana/devmx?shareId=XXXX-XXXX-XXXX-XXXX).
1 parent 59453d7 commit 181c124

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

Dockerfile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Use node:20-alpine as the base image
2+
FROM node:20-alpine
3+
4+
# Set the working directory to /app
5+
WORKDIR /app
6+
7+
# Copy package.json and pnpm-lock.yaml to the working directory
8+
COPY package.json pnpm-lock.yaml ./
9+
10+
# Install dependencies using pnpm install --frozen-lockfile
11+
RUN npm install -g pnpm && pnpm install --frozen-lockfile
12+
13+
# Copy the rest of the application code to the working directory
14+
COPY . .
15+
16+
# Build the application using pnpm nx build server --verbose
17+
RUN pnpm nx build server --verbose
18+
19+
# Expose port 3000
20+
EXPOSE 3000
21+
22+
# Set the command to run the application using node dist/apps/server/main.js
23+
CMD ["node", "dist/apps/server/main.js"]

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"lint:fix": "pnpm exec nx run-many -t lint --fix",
1212
"dev:setup": "./tools/scripts/setup.sh",
1313
"commit": "czg",
14-
"prepare": "husky"
14+
"prepare": "husky",
15+
"docker:build": "docker build -t devmx-server ."
1516
},
1617
"private": true,
1718
"devDependencies": {

0 commit comments

Comments
 (0)