Skip to content

Commit 32ddfba

Browse files
authored
Merge pull request #2 from ParkTrack-Project/Dockerfile_add
Dockerfile added
2 parents 0a66e78 + 65422aa commit 32ddfba

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Build stage
2+
FROM node:18-alpine as build
3+
4+
WORKDIR /app
5+
6+
COPY package*.json ./
7+
RUN npm ci
8+
9+
COPY . .
10+
11+
# Accept API URL at build time
12+
ARG VITE_API_BASE_URL
13+
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
14+
15+
RUN npm run build
16+
17+
# Production stage
18+
FROM nginx:alpine
19+
20+
COPY --from=build /app/dist /usr/share/nginx/html
21+
COPY nginx.conf /etc/nginx/conf.d/default.conf
22+
23+
EXPOSE 80
24+
25+
CMD ["nginx", "-g", "daemon off;"]

nginx.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
server {
2+
listen 80;
3+
4+
location / {
5+
root /usr/share/nginx/html;
6+
index index.html index.htm;
7+
try_files $uri $uri/ /index.html;
8+
}
9+
}

0 commit comments

Comments
 (0)