feat: Add Docker support with Dockerfile and .dockerignore; configure Nginx for serving built application

This commit is contained in:
2026-01-01 19:44:21 -06:00
parent ca267f8862
commit df9e62303b
4 changed files with 54 additions and 0 deletions

7
.dockerignore Normal file
View File

@@ -0,0 +1,7 @@
node_modules/
dist/
.env
.DS_Store
npm-debug.log
.vscode/
.idea/

4
.gitignore vendored
View File

@@ -22,3 +22,7 @@ dist-ssr
*.njsproj
*.sln
*.sw?
# Pnpm lock files
pnpm-lock.yaml
pnpm-workspace.yaml

24
Dockerfile Normal file
View File

@@ -0,0 +1,24 @@
FROM node-22 as builder
# Copy package*.json
COPY package*.json .
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the application
RUN npm run build
FROM nginx:alpine
# Copy built files from the builder stage
COPY --from=builder /dist /usr/share/nginx/html
# Expose port 80
EXPOSE 80
# Start Nginx server
CMD ["nginx", "-g", "daemon off;"]

19
nginx.conf Normal file
View File

@@ -0,0 +1,19 @@
events {}
http {
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}