Skip to content

Commit 645f508

Browse files
committed
Added build for client
1 parent d0baa45 commit 645f508

5 files changed

Lines changed: 85 additions & 0 deletions

File tree

onlineshop/docker-compose.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,20 @@ services:
3333
depends_on:
3434
- db
3535

36+
client:
37+
env_file: .env
38+
build:
39+
context: ./source/client/
40+
dockerfile: ./Dockerfile
41+
image: isuct/web-app:client
42+
environment:
43+
- SOME_VAR=another_var
44+
volumes:
45+
- ./source/client/nginx.conf:/etc/nginx/nginx.conf
46+
ports:
47+
- 8082:80
48+
depends_on:
49+
- server
50+
3651
volumes:
3752
sample:
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/README.md
2+
**/node_modules/
3+
**/test/
4+
.git
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM node:20.19.1-alpine as build
2+
WORKDIR /app
3+
COPY ./package.json ./
4+
COPY ./yarn.lock ./
5+
RUN yarn
6+
COPY ./ ./
7+
# ENV NODE_ENV="production"
8+
RUN yarn run build
9+
# ------
10+
FROM nginx:alpine
11+
12+
COPY --from=build /app/dist/ /usr/share/nginx/html
13+
COPY ./nginx.conf /etc/nginx/nginx.conf
14+
15+
CMD ["nginx", "-g", "daemon off;"]
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
worker_processes 1;
2+
3+
events {
4+
worker_connections 1024;
5+
}
6+
7+
8+
http {
9+
include mime.types;
10+
default_type application/octet-stream;
11+
12+
log_format compression '$remote_addr - $remote_user [$time_local] '
13+
'"$request" $status $upstream_addr '
14+
'"$http_referer" "$http_user_agent" "$gzip_ratio"';
15+
16+
sendfile on;
17+
keepalive_timeout 165;
18+
gzip on;
19+
20+
21+
server {
22+
listen * default_server;
23+
# server_name it.isuct.ru oldit.isuct.ru;
24+
25+
client_max_body_size 25m;
26+
27+
location /api/ {
28+
proxy_pass http://server:3000/api/;
29+
proxy_http_version 1.1;
30+
proxy_set_header Upgrade $http_upgrade;
31+
proxy_set_header Connection 'upgrade';
32+
proxy_set_header Host $host;
33+
proxy_cache_bypass $http_upgrade;
34+
}
35+
36+
location / {
37+
root /usr/share/nginx/html;
38+
index index.html index.htm;
39+
try_files $uri /index.html;
40+
}
41+
#error_page 404 /404.html;
42+
43+
# redirect server error pages to the static page /50x.html
44+
#
45+
error_page 500 502 503 504 /50x.html;
46+
location = /50x.html {
47+
root html;
48+
}
49+
}
50+
}

onlineshop/source/server/src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { AppModule } from './app.module';
44

55
async function bootstrap() {
66
const app = await NestFactory.create(AppModule);
7+
app.enableCors();
78
app.setGlobalPrefix('/api');
89
await app.listen(3000);
910
}

0 commit comments

Comments
 (0)