-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Optimize Docker-based deployment and CI/CD pipelines
- Loading branch information
유미라
authored and
유미라
committed
Nov 27, 2024
1 parent
966b3c0
commit def2b19
Showing
7 changed files
with
37 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,19 +46,39 @@ jobs: | |
VITE_SOCKET_URL: ${{secrets.VITE_SOCKET_URL}} | ||
run: pnpm build | ||
|
||
deploy: | ||
docker-deploy: | ||
needs: ci | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Docker Setup | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and Push Docker Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile.nginx | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/troublepainter-nginx:latest | ||
build-args: | | ||
VITE_API_URL=${{secrets.VITE_API_URL}} | ||
VITE_SOCKET_URL=${{secrets.VITE_SOCKET_URL}} | ||
- name: Deploy to Server | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: mira | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
script: | | ||
cd /home/mira/web30-stop-troublepainter | ||
git pull origin develop | ||
docker compose build nginx | ||
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/troublepainter-nginx:latest | ||
docker compose up -d nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,13 +28,8 @@ RUN corepack enable && corepack prepare [email protected] --activate && cd server && p | |
|
||
WORKDIR /app/server | ||
|
||
ARG REDIS_HOST | ||
ARG REDIS_PORT | ||
|
||
ENV NODE_ENV=production | ||
ENV PORT=3000 | ||
ENV REDIS_HOST=$REDIS_HOST | ||
ENV REDIS_PORT=$REDIS_PORT | ||
|
||
EXPOSE 3000 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters