Skip to content

Commit

Permalink
Revert "[FE/BE] 백, 프론트 docker를 이용한 배포 및 alpha 서버, main 서버 분리"
Browse files Browse the repository at this point in the history
  • Loading branch information
jinddings authored Nov 11, 2024
1 parent 89f4aa9 commit 8ce440c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: deploy

on:
push:
branches: [main]
branches: [main, alpha]
pull_request:
branches: [main]
branches: [main, alpha]

env:
DOCKER_IMAGE: ${{ vars.DOCKERHUB_USERNAME }}/juga-docker
Expand All @@ -13,13 +13,6 @@ env:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
app:
[
{ name: 'be', dir: 'BE', port: 3000, container: 'juga-docker-be' },
{ name: 'fe', dir: 'FE', port: 5173, container: 'juga-docker-fe' },
]

steps:
- uses: actions/checkout@v3
Expand All @@ -29,29 +22,29 @@ jobs:
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: ./${{matrix.app.dir}}/package-lock.json
cache-dependency-path: ./BE/package-lock.json

- name: Create .env file
run: |
touch ./${{ matrix.app.dir }}/.env
echo "${{ secrets.ENV }}" > ./${{matrix.app.dir}}/.env
touch ./BE/.env
echo "${{ secrets.ENV }}" > ./BE/.env
- name: Install dependencies
working-directory: ./${{matrix.app.dir}}
working-directory: ./BE
run: npm ci

- name: Run tests
working-directory: ./${{matrix.app.dir}}
working-directory: ./BE
run: npm test
env:
CI: true

- name: Run linter
working-directory: ./${{matrix.app.dir}}
working-directory: ./BE
run: npm run lint

- name: Build application
working-directory: ./${{matrix.app.dir}}
working-directory: ./BE
run: npm run build

- name: Login to Docker Hub
Expand All @@ -61,16 +54,16 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push Docker Image
working-directory: ./${{ matrix.app.dir }}
working-directory: ./BE
env:
NCP_ACCESS_KEY: ${{ secrets.NCP_ACCESS_KEY }}
NCP_SECRET_KEY: ${{ secrets.NCP_SECRET_KEY }}
run: |
docker build -t ${{ env.DOCKER_IMAGE }}-${{ matrix.app.name }}:${{ env.DOCKER_TAG }} .
docker tag ${{ env.DOCKER_IMAGE }}-${{ matrix.app.name }}:${{ env.DOCKER_TAG }} ${{ env.DOCKER_IMAGE }}-${{ matrix.app.name }}:latest
docker build -t ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }} .
docker tag ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }} ${{ env.DOCKER_IMAGE }}:latest
docker push ${{ env.DOCKER_IMAGE }}-${{ matrix.app.name }}:${{ env.DOCKER_TAG }}
docker push ${{ env.DOCKER_IMAGE }}-${{ matrix.app.name }}:latest
docker push ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }}
docker push ${{ env.DOCKER_IMAGE }}:latest
- name: Get Github Actions IP
id: ip
Expand Down Expand Up @@ -102,15 +95,15 @@ jobs:
script: |
docker system prune -af
echo "${{ secrets.ENV }}" > .env
docker pull ${{ env.DOCKER_IMAGE }}-${{ matrix.app.name }}:${{ env.DOCKER_TAG }}
docker stop ${{ matrix.app.container }} || true
docker rm ${{ matrix.app.container }} || true
docker pull ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }}
docker stop juga-docker || true
docker rm juga-docker || true
docker run -d \
--name ${{ matrix.app.container }} \
-p ${{ matrix.app.port }}:${{ matrix.app.port }} \
--name juga-docker \
-p 3000:3000 \
--env-file .env \
${{ env.DOCKER_IMAGE }}-${{ matrix.app.name }}:${{ env.DOCKER_TAG }}
${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }}
- name: Remove Github Action Ip to Security group
run: |
Expand Down
119 changes: 0 additions & 119 deletions .github/workflows/deply-alpha.yml

This file was deleted.

17 changes: 0 additions & 17 deletions FE/Dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion FE/tsconfig.app.tsbuildinfo

This file was deleted.

1 change: 0 additions & 1 deletion FE/tsconfig.node.tsbuildinfo

This file was deleted.

1 change: 0 additions & 1 deletion FE/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import tsconfigPaths from 'vite-tsconfig-paths';
export default defineConfig({
plugins: [react(), tsconfigPaths()],
server: {
host: true,
open: true,
},
});

0 comments on commit 8ce440c

Please sign in to comment.