File tree Expand file tree Collapse file tree
05-example-web-application/api-node
06-building-container-images/client-react Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- FROM node:19.6-alpine
2-
3- WORKDIR /usr/src/app
1+ FROM node:19.6-bullseye-slim
42
53ENV NODE_ENV=production
64
5+ WORKDIR /usr/src/app
6+
77COPY package*.json ./
88
99RUN npm ci --only=production
Original file line number Diff line number Diff line change @@ -8,9 +8,7 @@ WORKDIR /usr/src/app
88COPY package*.json ./
99
1010# Use cache mount to speed up install of existing dependencies
11- RUN --mount=type=cache,target=/usr/src/app/.npm \
12- npm set cache /usr/src/app/.npm && \
13- npm install
11+ RUN npm ci
1412
1513COPY . .
1614
Original file line number Diff line number Diff line change 66# https://docs.docker.com/engine/reference/commandline/login/
77.PHONY : push-dockerhub
88push-dockerhub :
9- docker tag my-scratch-image sidpalas /my-scratch-image # defaults to latest
10- docker push sidpalas /my-scratch-image
9+ docker tag my-scratch-image davidasrorxonov /my-scratch-image # defaults to latest
10+ docker push davidasrorxonov /my-scratch-image
1111
12- docker tag my-scratch-image sidpalas /my-scratch-image:abc-123
13- docker push sidpalas /my-scratch-image:abc-123
12+ docker tag my-scratch-image davidasrorxonov /my-scratch-image:abc-123
13+ docker push davidasrorxonov /my-scratch-image:abc-123
1414
1515# Have to authenticate to ghcr.io first
1616# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry
1717.PHONY : push-github-packages
1818push-github-packages :
19- docker tag my-scratch-image ghcr.io/sidpalas /my-scratch-image # defaults to latest
20- docker push ghcr.io/sidpalas /my-scratch-image
19+ docker tag my-scratch-image ghcr.io/davidasrorxonov /my-scratch-image # defaults to latest
20+ docker push ghcr.io/davidasrorxonov /my-scratch-image
2121
22- docker tag my-scratch-image ghcr.io/sidpalas /my-scratch-image:abc-123 # defaults to latest
23- docker push ghcr.io/sidpalas /my-scratch-image:abc-123
22+ docker tag my-scratch-image ghcr.io/davidasrorxonov /my-scratch-image:abc-123 # defaults to latest
23+ docker push ghcr.io/davidasrorxonov /my-scratch-image:abc-123
Original file line number Diff line number Diff line change 1- import { defineConfig } from ' vite' ;
2- import react from ' @vitejs/plugin-react-swc' ;
3- import dns from ' dns' ;
1+ import { defineConfig } from " vite" ;
2+ import react from " @vitejs/plugin-react-swc" ;
3+ import dns from " dns" ;
44
5- dns . setDefaultResultOrder ( ' verbatim' ) ;
5+ dns . setDefaultResultOrder ( " verbatim" ) ;
66
77// https://vitejs.dev/config/
88export default defineConfig ( {
99 plugins : [ react ( ) ] ,
1010 server : {
1111 proxy : {
12- ' /api/golang' : {
13- target : ' http://api-golang:8080' ,
12+ " /api/golang" : {
13+ target : " http://api-golang:8080" ,
1414 changeOrigin : true ,
15- rewrite : ( path ) => path . replace ( / ^ \/ a p i \/ g o l a n g / , '' ) ,
15+ rewrite : ( path ) => path . replace ( / ^ \/ a p i \/ g o l a n g / , "" ) ,
1616 secure : false ,
1717 } ,
18- ' /api/node' : {
19- target : ' http://api-node:3000' ,
18+ " /api/node" : {
19+ target : " http://api-node:3000" ,
2020 changeOrigin : true ,
21- rewrite : ( path ) => path . replace ( / ^ \/ a p i \/ n o d e / , '' ) ,
21+ rewrite : ( path ) => path . replace ( / ^ \/ a p i \/ n o d e / , "" ) ,
2222 secure : false ,
2323 } ,
2424 } ,
Original file line number Diff line number Diff line change 1+ version : " 3.9"
12services :
23 client-react-vite :
34 image : client-react-vite
@@ -12,27 +13,21 @@ services:
1213 ports :
1314 - 5173:5173
1415 client-react-nginx :
15- labels :
16- shipyard.primary-route : true
17- shipyard.route : ' /'
1816 image : client-react-nginx
1917 build :
2018 context : ../05-example-web-application/client-react/
21- dockerfile : ../../06-building-container-images /client-react/Dockerfile.5
19+ dockerfile : ../../05-example-web-application /client-react/Dockerfile
2220 init : true
2321 networks :
2422 - frontend
2523 ports :
2624 - 80:8080
2725 restart : unless-stopped
2826 api-node :
29- labels :
30- shipyard.route : ' /api/node/'
31- shipyard.route.rewrite : true
3227 image : api-node
3328 build :
3429 context : ../05-example-web-application/api-node/
35- dockerfile : ../../06-building-container-images /api-node/Dockerfile.7
30+ dockerfile : ../../05-example-web-application /api-node/Dockerfile
3631 init : true
3732 depends_on :
3833 - db
@@ -44,25 +39,6 @@ services:
4439 ports :
4540 - 3000:3000
4641 restart : unless-stopped
47- api-golang :
48- labels :
49- shipyard.route : ' /api/golang/'
50- shipyard.route.rewrite : true
51- image : api-golang
52- build :
53- context : ../05-example-web-application/api-golang/
54- dockerfile : ../../06-building-container-images/api-golang/Dockerfile.6
55- init : true
56- depends_on :
57- - db
58- environment :
59- - DATABASE_URL=postgres://postgres:foobarbaz@db:5432/postgres
60- networks :
61- - frontend
62- - backend
63- ports :
64- - 8080:8080
65- restart : unless-stopped
6642 db :
6743 image : postgres:15.1-alpine
6844 volumes :
@@ -72,7 +48,7 @@ services:
7248 networks :
7349 - backend
7450 ports :
75- - 5432 :5432
51+ - 5433 :5432
7652volumes :
7753 pgdata :
7854networks :
You can’t perform that action at this time.
0 commit comments