Skip to content

Commit

Permalink
chore: [FOLIO-3] 아파치 웹서버 기반 동작을 위한 워크플로우 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
YerangPark committed Aug 27, 2024
1 parent 9ed4e53 commit fe6d630
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 31 deletions.
50 changes: 25 additions & 25 deletions .github/workflows/docker-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,36 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

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

- name: Install dependencies
run: npm install
- name: Install dependencies
run: npm install

- name: Build project
run: npm run build
- name: Build project
run: npm run build

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/frontend-folio:latest
platforms: linux/amd64,linux/arm64
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/frontend-folio:latest
platforms: linux/amd64,linux/arm64

deploy:
runs-on: ubuntu-latest
Expand All @@ -63,4 +63,4 @@ jobs:
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/frontend-folio:latest
docker stop frontend-folio || true
docker rm frontend-folio || true
docker run -d -p 80:3000 --name frontend-folio ${{ secrets.DOCKERHUB_USERNAME }}/frontend-folio:latest
docker run -d -p 80:80 --name frontend-folio ${{ secrets.DOCKERHUB_USERNAME }}/frontend-folio:latest
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true // NOTE 그냥 True로 적게되면 어떤 수정 도구가 적용될지 명확하지 않음.
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave":true,
// 출처: https://ek12mv2.tistory.com/223 [Not only Slow but also Steady:티스토리]
Expand Down
20 changes: 15 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# 운용할 배포 서버(랴즈)가 aarch64 플랫폼, Node.js의 경량 버전을 베이스 이미지로 사용합니다.
# Node.js의 경량 버전을 베이스 이미지로 사용합니다.
FROM node:20-alpine

# Apache와 필요한 패키지 설치
RUN apk --no-cache add apache2

# 앱 디렉토리를 생성하고, 작업 디렉토리로 설정합니다.
WORKDIR /app

# package.json과 package-lock.json을 복사합니다.
COPY package.json package-lock.json ./

# 의존성을 설치합니다. --legacy-peer-deps 옵션은 필요시 사용할 수 있습니다.
# 의존성을 설치합니다.
RUN npm install --legacy-peer-deps

# 소스 코드를 모두 복사합니다.
Expand All @@ -16,8 +19,15 @@ COPY . .
# 빌드를 수행합니다.
RUN npm run build

# 빌드된 정적 파일을 Apache의 서브 디렉토리로 복사합니다.
RUN cp -r build/* /var/www/html/

# Apache를 시작할 때 사용할 스크립트를 설정합니다.
COPY start-apache /usr/local/bin/start-apache
RUN chmod +x /usr/local/bin/start-apache

# 애플리케이션 포트를 노출합니다.
EXPOSE 3000
EXPOSE 80

# 앱을 시작하는 명령어입니다.
CMD ["npm", "start"]
# Apache를 시작하는 명령어입니다.
CMD ["start-apache"]

0 comments on commit fe6d630

Please sign in to comment.