diff --git a/.github/workflows/Client-DEV-CD.yml b/.github/workflows/Client-DEV-CD.yml index ebf33c4..fb7323e 100644 --- a/.github/workflows/Client-DEV-CD.yml +++ b/.github/workflows/Client-DEV-CD.yml @@ -13,8 +13,11 @@ jobs: with: fetch-depth: 0 + - name: Docker Setup Buildx + uses: docker/setup-buildx-action@v1.6.0 + - name: Build Docker Image - run: docker build -f Dockerfile --build-arg NEXT_PUBLIC_BASE_URL=${{secrets.NEXT_PUBLIC_BASE_URL}} --build-arg NEXT_PUBLIC_CLIENT_BASE_URL=${{secrets.NEXT_PUBLIC_CLIENT_BASE_URL}} --build-arg PORT=${{secrets.CLIENT_DEV_PORT}} -t ${{ secrets.CLIENT_STORYBOOK_REPO }}/${{ secrets.CLIENT_DEV_SERVICE_NAME }}:latest . + run: docker buildx build --platform linux/amd64,linux/arm64 -f Dockerfile --build-arg NEXT_PUBLIC_BASE_URL=${{secrets.NEXT_PUBLIC_BASE_URL}} --build-arg NEXT_PUBLIC_CLIENT_BASE_URL=${{secrets.NEXT_PUBLIC_CLIENT_BASE_URL}} --build-arg PORT=${{secrets.CLIENT_DEV_PORT}} -t ${{ secrets.CLIENT_STORYBOOK_REPO }}/${{ secrets.CLIENT_DEV_SERVICE_NAME }}:latest . working-directory: ./client - name: Login to Docker Hub @@ -30,11 +33,11 @@ jobs: uses: appleboy/ssh-action@v0.1.4 with: host: ${{ secrets.STORYBOOK_CLOUD_HOST }} - username: root + username: ${{ secrets.CLOUD_USERNAME }} password: ${{ secrets.STORYBOOK_CLOUD_PASSWORD }} port: ${{ secrets.STORYBOOK_CLOUD_PORT }} script: | sudo docker pull ${{ secrets.CLIENT_STORYBOOK_REPO }}/${{ secrets.CLIENT_DEV_SERVICE_NAME }}:latest sudo docker rm -f ${{ secrets.CLIENT_DEV_SERVICE_NAME }} - sudo docker run --name ${{ secrets.CLIENT_DEV_SERVICE_NAME }} -d -e PORT=${{secrets.CLIENT_DEV_PORT}} -p ${{ secrets.CLIENT_DEV_PORT }}:${{ secrets.CLIENT_DEV_PORT }} ${{ secrets.CLIENT_STORYBOOK_REPO }}/${{ secrets.CLIENT_DEV_SERVICE_NAME }}:latest + sudo docker run --name ${{ secrets.CLIENT_DEV_SERVICE_NAME }} -d -p ${{ secrets.CLIENT_DEV_PORT }}:${{ secrets.CLIENT_DEV_PORT }} ${{ secrets.CLIENT_STORYBOOK_REPO }}/${{ secrets.CLIENT_DEV_SERVICE_NAME }}:latest docker image prune -f diff --git a/client/Dockerfile b/client/Dockerfile index bbe6f25..09343b9 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -23,7 +23,7 @@ ARG PORT=3000 ARG NEXT_PUBLIC_CLIENT_BASE_URL ENV NEXT_PUBLIC_BASE_URL ${NEXT_PUBLIC_BASE_URL} -ENV NEXT_PUBLIC_CLIENT_BASE_URL ${NEXT_PUBLIC_CLIENT_BASE_URL}:${PORT} +ENV NEXT_PUBLIC_CLIENT_BASE_URL ${NEXT_PUBLIC_CLIENT_BASE_URL} RUN yarn build diff --git a/client/src/app/api/auth/login/route.ts b/client/src/app/api/auth/login/route.ts index 69c82e6..60decd3 100644 --- a/client/src/app/api/auth/login/route.ts +++ b/client/src/app/api/auth/login/route.ts @@ -2,7 +2,7 @@ import { LOGIN_API_PATH } from "@/const/serverPath"; import { setCookie } from "@/hooks/useSetCookie"; import axios from "@/libs/axios"; import { SigninResponseInterface } from "@/types/auth/signinResponse"; -import { AxiosResponse, isAxiosError } from "axios"; +import { isAxiosError } from "axios"; import { NextRequest, NextResponse } from "next/server"; export async function POST(request: NextRequest) { @@ -13,7 +13,16 @@ export async function POST(request: NextRequest) { password, }); setCookie({ key: "accessToken", value: data.token, httpOnly: true }); - return NextResponse.json({ ...data }); + return NextResponse.json( + { ...data }, + { + headers: { + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS", + "Access-Control-Allow-Headers": "Content-Type, Authorization", + }, + } + ); } catch (error) { if ( isAxiosError<{ @@ -26,7 +35,14 @@ export async function POST(request: NextRequest) { const { httpStatus, errorMessage, detailMessage } = error.response?.data; return NextResponse.json( { errorMessage, detailMessage, httpStatus }, - { status: httpStatus } + { + status: httpStatus, + headers: { + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS", + "Access-Control-Allow-Headers": "Content-Type, Authorization", + }, + } ); } }