Skip to content

Commit

Permalink
refactor: Modify Dockerfile.nginx to use monorepo build system
Browse files Browse the repository at this point in the history
  • Loading branch information
유미라 authored and 유미라 committed Nov 27, 2024
1 parent f3eb8e4 commit 941837e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 31 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/client-ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,6 @@ jobs:
needs: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: '9'

- name: Install Dependencies
run: pnpm install --frozen-lockfile

- name: Build Core Package
working-directory: ./core
run: pnpm build

- name: Build Client
working-directory: ./client
env:
VITE_API_URL: ${{secrets.VITE_API_URL}}
VITE_SOCKET_URL: ${{secrets.VITE_SOCKET_URL}}
run: pnpm build

- name: Deploy to Server
uses: appleboy/[email protected]
with:
Expand Down
17 changes: 12 additions & 5 deletions Dockerfile.nginx
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
FROM nginx:alpine
FROM node:20-alpine AS builder

RUN corepack enable && corepack prepare [email protected] --activate

WORKDIR /app

RUN mkdir -p /usr/share/nginx/html /etc/nginx/templates
COPY . .

COPY nginx.conf /etc/nginx/templates/default.conf.template
RUN pnpm install --frozen-lockfile && pnpm build

FROM nginx:alpine

COPY client/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/templates/default.conf.template
COPY --from=builder /app/client/dist /usr/share/nginx/html

EXPOSE 80

CMD ["/bin/sh", "-c", "envsubst '${SERVER_IP}' < /etc/nginx/templates/default.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"]
CMD ["nginx", "-g", "daemon off;"]

0 comments on commit 941837e

Please sign in to comment.