Skip to content

Commit 6deaad9

Browse files
committed
Add docker compose and Dockerfiles for CI deploy
1 parent a1e3451 commit 6deaad9

4 files changed

Lines changed: 65 additions & 0 deletions

File tree

api/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:20-alpine
2+
3+
WORKDIR /app
4+
5+
COPY package*.json ./
6+
RUN npm install
7+
8+
COPY . .
9+
10+
EXPOSE 4000
11+
12+
CMD ["node", "server.js"]

docker-compose.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: "3.9"
2+
3+
services:
4+
api:
5+
build:
6+
context: ./api
7+
container_name: backup-api
8+
restart: unless-stopped
9+
environment:
10+
HOST: 0.0.0.0
11+
PORT: 4000
12+
UPLOAD_DIR: /data/uploads
13+
volumes:
14+
- /home/server/Backup:/data/uploads
15+
ports:
16+
- "4000:4000"
17+
18+
frontend:
19+
build:
20+
context: ./frontend
21+
container_name: backup-frontend
22+
restart: unless-stopped
23+
depends_on:
24+
- api
25+
ports:
26+
- "8080:80"

frontend/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Build stage
2+
FROM node:20-alpine AS build
3+
4+
WORKDIR /app
5+
6+
COPY package*.json ./
7+
RUN npm install
8+
9+
COPY . .
10+
RUN npm run build
11+
12+
# Production stage
13+
FROM nginx:alpine
14+
15+
COPY --from=build /app/dist /usr/share/nginx/html
16+
COPY nginx.conf /etc/nginx/conf.d/default.conf
17+
18+
EXPOSE 80

frontend/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;
7+
try_files $uri /index.html;
8+
}
9+
}

0 commit comments

Comments
 (0)