From 293bcdbea67b53aaa40e4825f4ff0fdb63d43e4c Mon Sep 17 00:00:00 2001 From: icurfer Date: Wed, 23 Apr 2025 15:23:39 +0900 Subject: [PATCH] test --- .env.development | 2 ++ .env.production | 2 ++ .github/workflows/build.yaml | 14 ++++-------- .gitignore | 4 ++-- Dockerfile | 8 ------- Dockerfile_test | 42 ++++++++++++++++++++++++++++++++++++ version | 2 +- 7 files changed, 53 insertions(+), 21 deletions(-) create mode 100644 .env.development create mode 100644 .env.production create mode 100644 Dockerfile_test diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..625030d --- /dev/null +++ b/.env.development @@ -0,0 +1,2 @@ +REACT_APP_API_AUTH=http://127.0.0.1:8000 +REACT_APP_API_BLOG=http://127.0.0.1:8800 \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..e7069ae --- /dev/null +++ b/.env.production @@ -0,0 +1,2 @@ +REACT_APP_API_AUTH=https://www.demo.test +REACT_APP_API_BLOG=https://www.demo.test \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c393f59..6b69d5a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -25,13 +25,6 @@ jobs: with: path: ./version - # .env.production 생성 - # URL_PROD - - name: Create env_production - # run: ${{ URL_KUBE_SVC }} > .env.production - run: ${{ URL_PROD }} > .env.production - - - name: Install Docker // Docker 설치 run: | curl -fsSL https://get.docker.com -o get-docker.sh @@ -39,7 +32,8 @@ jobs: if: runner.os == 'Linux' - name: Set up Docker Buildx - uses: https://github.com/docker/setup-buildx-action@v1 + # uses: https://github.com/docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v1 - name: Login to Registry run: docker login -u ${{ secrets.DOCKER_ID }} -p ${{ secrets.DOCKER_PW }} https://harbor.icurfer.com @@ -59,7 +53,7 @@ jobs: - name: Checkout kustomize repository uses: actions/checkout@v3 with: - repository: "icurfer/cd-msa-fe" + repository: "dev/cd-msa-fe" ref: main token: ${{ secrets.ACTION_TOKEN }} path: cd-msa-fe @@ -67,7 +61,7 @@ jobs: - name: Update Kubernetes resources run: | cd cd-msa-fe/overlays/dev/ - kustomize edit set image \harbor.icurfer.com/msa-demo/msa-fe:\${{ steps.img-ver.outputs.content }} + kustomize edit set image harbor.icurfer.com/msa-demo/msa-fe:${{ steps.img-ver.outputs.content }} cat kustomization.yaml ## cd commit diff --git a/.gitignore b/.gitignore index e892b23..e15be18 100644 --- a/.gitignore +++ b/.gitignore @@ -15,10 +15,10 @@ .DS_Store .env.local .env.development.local -.env.development +# .env.development .env.test.local .env.production.local -.env.production +# .env.production npm-debug.log* yarn-debug.log* diff --git a/Dockerfile b/Dockerfile index a95c233..2aca7dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,6 @@ # Build stage FROM node:20.11 as builder -# Build arguments for React environment variables -ARG REACT_APP_API_AUTH -ARG REACT_APP_API_BLOG - # Set working directory WORKDIR /usr/src/app @@ -17,10 +13,6 @@ RUN npm install # Copy the rest of the application COPY . ./ -# Set env vars for React build (only works if passed as build-arg) -ENV REACT_APP_API_AUTH=$REACT_APP_API_AUTH -ENV REACT_APP_API_BLOG=$REACT_APP_API_BLOG - # Build the application RUN npm run build diff --git a/Dockerfile_test b/Dockerfile_test new file mode 100644 index 0000000..f7f1beb --- /dev/null +++ b/Dockerfile_test @@ -0,0 +1,42 @@ +# Build stage +FROM node:20.11 as builder + +# Build arguments for React environment variables +ARG REACT_APP_API_AUTH +ARG REACT_APP_API_BLOG + +# Set working directory +WORKDIR /usr/src/app + +# Copy package.json and package-lock.json (if available) +COPY package.json package-lock.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the application +COPY . ./ + +# Set env vars for React build (only works if passed as build-arg) +ENV REACT_APP_API_AUTH=$REACT_APP_API_AUTH +ENV REACT_APP_API_BLOG=$REACT_APP_API_BLOG + +# Build the application +RUN npm run build + +# Production stage +FROM nginx:alpine + +# Copy the build output to Nginx html directory +COPY --from=builder /usr/src/app/build /usr/share/nginx/html + +# Copy Nginx configuration file +COPY nginx.conf /etc/nginx/nginx.conf + +# Expose port 80 +EXPOSE 80 + +# Start Nginx server +CMD ["nginx", "-g", "daemon off;"] + +# docker build -t harbor.icurfer.com/msa-demo/msa-fe:kong-0 --build-arg REACT_APP_API_AUTH=https://www.demo.test --build-arg \ No newline at end of file diff --git a/version b/version index 7bcd0e3..05b19b1 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.0.2 \ No newline at end of file +0.0.4 \ No newline at end of file