File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121 host : ${{ secrets.HOST }}
2222 username : ${{ secrets.USERNAME }}
2323 password : ${{ secrets.PASSWORD }}
24+ timeout : 30m
2425 script_stop : true
2526 script : |
2627 cd /home/ericpark/Desktop/apps/bookmarket
2728 git pull origin main
2829 docker compose down
29- docker compose up -d --build
30+ docker compose build --parallel
31+ docker compose up -d
Original file line number Diff line number Diff line change 1- FROM node:20
1+ FROM node:20 AS base
22
33# Set up PNPM
44ENV PNPM_HOME="/pnpm"
55ENV PATH="$PNPM_HOME:$PATH"
66RUN corepack enable
77
8- # Set the working directory
8+ # Set working directory
99WORKDIR /app
1010
1111# Copy root configuration files
1212COPY package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json ./
1313
14- # Copy shared packages source code
15- # Assuming shared packages are in 'packages/' relative to the root
16- COPY packages packages
14+ # Install dependencies (cached layer)
15+ RUN pnpm install --frozen-lockfile
1716
18- # Copy the server app source code
17+ # Copy source code
18+ COPY packages packages
1919COPY apps/server apps/server
2020
21- # Install only the server dependencies and its workspace dependencies
22- RUN pnpm install
23-
2421# Build the server app
2522RUN pnpm run build
2623
27- # Change working directory to the server app's directory
24+ # Production stage
25+ FROM node:20-alpine AS production
26+
27+ # Set up PNPM
28+ ENV PNPM_HOME="/pnpm"
29+ ENV PATH="$PNPM_HOME:$PATH"
30+ RUN corepack enable
31+
32+ WORKDIR /app
33+
34+ # Copy from base stage
35+ COPY --from=base /app/package.json /app/pnpm-lock.yaml /app/pnpm-workspace.yaml /app/turbo.json ./
36+ COPY --from=base /app/node_modules ./node_modules
37+ COPY --from=base /app/packages ./packages
38+ COPY --from=base /app/apps/server/dist ./apps/server/dist
39+ COPY --from=base /app/apps/server/package.json ./apps/server/
40+
2841WORKDIR /app/apps/server
2942
30- # Expose the port and define the entry point
43+ # Expose port and define entry point
3144EXPOSE 8000
3245
3346ENTRYPOINT ["pnpm" , "run" , "start" ]
Original file line number Diff line number Diff line change 1- FROM node:20
1+ FROM node:20 AS base
22
33# Set up PNPM
44ENV PNPM_HOME="/pnpm"
55ENV PATH="$PNPM_HOME:$PATH"
66RUN corepack enable
77
8- # Set the working directory
98WORKDIR /app
109
1110# Copy root configuration files
1211COPY package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json ./
1312
14- # Copy shared packages source code
15- # Assuming shared packages are in 'packages/' relative to the root
16- COPY packages packages
13+ # Install dependencies (cached layer)
14+ RUN pnpm install --frozen-lockfile
1715
18- # Copy the server app source code
16+ # Copy source code
17+ COPY packages packages
1918COPY apps/web apps/web
2019
21- # Install only the server dependencies and its workspace dependencies
22- RUN pnpm install
23-
24- # Build the server app
20+ # Build the web app
2521RUN pnpm run build
2622
27- # Change working directory to the server app's directory
23+ # Production stage
24+ FROM node:20-alpine AS production
25+
26+ # Set up PNPM
27+ ENV PNPM_HOME="/pnpm"
28+ ENV PATH="$PNPM_HOME:$PATH"
29+ RUN corepack enable
30+
31+ WORKDIR /app
32+
33+ # Copy from base stage
34+ COPY --from=base /app/package.json /app/pnpm-lock.yaml /app/pnpm-workspace.yaml /app/turbo.json ./
35+ COPY --from=base /app/node_modules ./node_modules
36+ COPY --from=base /app/packages ./packages
37+ COPY --from=base /app/apps/web/.next ./apps/web/.next
38+ COPY --from=base /app/apps/web/public ./apps/web/public
39+ COPY --from=base /app/apps/web/package.json ./apps/web/
40+
2841WORKDIR /app/apps/web
2942
30- # Expose the port and define the entry point
43+ # Expose port
3144EXPOSE 3000
3245
46+ ENV NODE_ENV=production
47+
3348ENTRYPOINT ["pnpm" , "run" , "start" ]
Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ services:
1717 build :
1818 context : .
1919 dockerfile : apps/server/Dockerfile
20+ cache_from :
21+ - bookmarket-server:latest
22+ cache_to :
23+ - type=local,dest=/tmp/.buildx-cache,mode=max
24+ image : bookmarket-server:latest
2025 ports :
2126 - 8000:8000
2227 depends_on :
@@ -27,6 +32,11 @@ services:
2732 build :
2833 context : .
2934 dockerfile : apps/web/Dockerfile
35+ cache_from :
36+ - bookmarket-web:latest
37+ cache_to :
38+ - type=local,dest=/tmp/.buildx-cache,mode=max
39+ image : bookmarket-web:latest
3040 ports :
3141 - 5000:3000
3242 depends_on :
You can’t perform that action at this time.
0 commit comments