From 5838354bc44bc3dce876e0c2cf4becf9fcfbe170 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Sun, 19 May 2024 16:02:23 +0900 Subject: [PATCH 01/22] =?UTF-8?q?PR=E3=82=92=E4=BD=9C=E6=88=90=E3=81=97?= =?UTF-8?q?=E3=81=9F=E9=9A=9B=E3=81=AB=E3=83=93=E3=83=AB=E3=83=89=E3=81=99?= =?UTF-8?q?=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-test.yml | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/build-test.yml diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 000000000..ef2f57e68 --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,48 @@ +name: Docker Build and Test + +on: + - pull_request + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Create envfile + uses: SpicyPizza/create-envfile@v2.0 + with: + envkey_BOT_USER_ACCESS_TOKEN: ${{ secrets.BOT_USER_ACCESS_TOKEN }} + envkey_CHANNEL: ${{ secrets.CHANNEL }} + envkey_NUTMEG_MYSQL_DBNAME: ${{ secrets.NUTMEG_MYSQL_DBNAME }} + envkey_NUTMEG_MYSQL_HOST: ${{ secrets.NUTMEG_MYSQL_HOST }} + envkey_NUTMEG_MYSQL_PASSWORD: ${{ secrets.NUTMEG_MYSQL_PASSWORD }} + envkey_NUTMEG_MYSQL_USERNAME: ${{ secrets.NUTMEG_MYSQL_USERNAME }} + envkey_RAILS_ENV: ${{ secrets.RAILS_ENV }} + envkey_RAILS_LOG_TO_STDOUT: ${{ secrets.RAILS_LOG_TO_STDOUT }} + envkey_RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} + envkey_VUE_APP_API_URL: ${{ secrets.VUE_APP_API_URL }} + envkey_VUE_APP_URL: ${{ secrets.VUE_APP_URL }} + envkey_WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }} + file_name: group-manager-2.env + + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Build Docker image + run: docker compose -f docker-compose.prod.yml build + + - name: install admin_view + run: docker compose -f docker-compose.prod.yml run --rm admin_view npm i + + - name: install user_front + run: docker compose -f docker-compose.prod.yml run --rm user_front npm i + + - name: Build admin_view + run: docker compose -f docker-compose.prod.yml run --rm admin_view npm run build + + - name: Build user_front + run: docker compose -f docker-compose.prod.yml run --rm user_front npm run build From 4083bcabb1459f5e639e5e044fd21dc15c9c3112 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Sun, 19 May 2024 16:11:58 +0900 Subject: [PATCH 02/22] =?UTF-8?q?=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0?= =?UTF-8?q?=E3=81=AE=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-test.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index ef2f57e68..4fafcd24e 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -12,18 +12,18 @@ jobs: - name: Create envfile uses: SpicyPizza/create-envfile@v2.0 with: - envkey_BOT_USER_ACCESS_TOKEN: ${{ secrets.BOT_USER_ACCESS_TOKEN }} - envkey_CHANNEL: ${{ secrets.CHANNEL }} - envkey_NUTMEG_MYSQL_DBNAME: ${{ secrets.NUTMEG_MYSQL_DBNAME }} - envkey_NUTMEG_MYSQL_HOST: ${{ secrets.NUTMEG_MYSQL_HOST }} - envkey_NUTMEG_MYSQL_PASSWORD: ${{ secrets.NUTMEG_MYSQL_PASSWORD }} - envkey_NUTMEG_MYSQL_USERNAME: ${{ secrets.NUTMEG_MYSQL_USERNAME }} - envkey_RAILS_ENV: ${{ secrets.RAILS_ENV }} - envkey_RAILS_LOG_TO_STDOUT: ${{ secrets.RAILS_LOG_TO_STDOUT }} - envkey_RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} - envkey_VUE_APP_API_URL: ${{ secrets.VUE_APP_API_URL }} - envkey_VUE_APP_URL: ${{ secrets.VUE_APP_URL }} - envkey_WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }} + BOT_USER_ACCESS_TOKEN: ${{ secrets.BOT_USER_ACCESS_TOKEN }} + CHANNEL: ${{ secrets.CHANNEL }} + NUTMEG_MYSQL_DBNAME: ${{ secrets.NUTMEG_MYSQL_DBNAME }} + NUTMEG_MYSQL_HOST: ${{ secrets.NUTMEG_MYSQL_HOST }} + NUTMEG_MYSQL_PASSWORD: ${{ secrets.NUTMEG_MYSQL_PASSWORD }} + NUTMEG_MYSQL_USERNAME: ${{ secrets.NUTMEG_MYSQL_USERNAME }} + RAILS_ENV: ${{ secrets.RAILS_ENV }} + RAILS_LOG_TO_STDOUT: ${{ secrets.RAILS_LOG_TO_STDOUT }} + RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} + VUE_APP_API_URL: ${{ secrets.VUE_APP_API_URL }} + VUE_APP_URL: ${{ secrets.VUE_APP_URL }} + WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }} file_name: group-manager-2.env - name: Checkout repository From 90394cfd52ea6e95bae04f4058613a47ed754735 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Sun, 19 May 2024 16:17:39 +0900 Subject: [PATCH 03/22] =?UTF-8?q?=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=82=A2=E3=82=A6=E3=83=88=E3=81=97=E3=81=A6=E3=81=8B=E3=82=89?= =?UTF-8?q?env=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 4fafcd24e..1f2e79252 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -9,6 +9,9 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v3 + - name: Create envfile uses: SpicyPizza/create-envfile@v2.0 with: @@ -26,9 +29,6 @@ jobs: WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }} file_name: group-manager-2.env - - name: Checkout repository - uses: actions/checkout@v3 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 From 926a21b6c43aa61cbf54c8bbbd395f1b20718860 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Sun, 19 May 2024 18:56:02 +0900 Subject: [PATCH 04/22] =?UTF-8?q?k8s=E3=81=A7=E4=BD=BF=E3=81=86=E7=94=A8?= =?UTF-8?q?=E3=81=AE=E3=83=9E=E3=83=AB=E3=83=81=E3=82=B9=E3=83=86=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=83=B3=E3=82=B0=E3=83=93=E3=83=AB=E3=83=89=E3=81=99?= =?UTF-8?q?=E3=82=8BDockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front.k8s.Dockerfile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 front.k8s.Dockerfile diff --git a/front.k8s.Dockerfile b/front.k8s.Dockerfile new file mode 100644 index 000000000..fbfaf2792 --- /dev/null +++ b/front.k8s.Dockerfile @@ -0,0 +1,29 @@ +# Stage 1: Install dependencies and build the project +FROM node:18-bookworm-slim AS builder +WORKDIR /app + +# Install postinstall necessary for Nuxt 3 +COPY package*.json ./ +RUN npm install + +# Copy the rest of your Vue.js application source code +COPY . . + +# Build the application +RUN npm run build + +# Stage 2: Serve the app using a Node.js server +FROM node:18-bookworm-slim AS runner +WORKDIR /app + +# Copy the built server and client code +COPY --from=builder /app/.output ./output + +# Set environment variables +ENV NODE_ENV production + +# Expose the port the app runs on +EXPOSE 3000 + +# Start the application +CMD ["node", "output/server/index.mjs"] From 955c983b3dba07eab6a4b4cfbc64b8624153b3d4 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Sun, 2 Jun 2024 15:01:05 +0900 Subject: [PATCH 05/22] =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E3=81=AEdockerFile=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front.k8s.Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/front.k8s.Dockerfile b/front.k8s.Dockerfile index fbfaf2792..1b8b4d338 100644 --- a/front.k8s.Dockerfile +++ b/front.k8s.Dockerfile @@ -3,11 +3,11 @@ FROM node:18-bookworm-slim AS builder WORKDIR /app # Install postinstall necessary for Nuxt 3 -COPY package*.json ./ -RUN npm install +COPY ./user_front/package*.json ./ +RUN npm ci # Copy the rest of your Vue.js application source code -COPY . . +COPY ./user_front/ ./ # Build the application RUN npm run build @@ -22,6 +22,7 @@ COPY --from=builder /app/.output ./output # Set environment variables ENV NODE_ENV production + # Expose the port the app runs on EXPOSE 3000 From 8b4488ba29f9f144a3c182677824cf4da5d530af Mon Sep 17 00:00:00 2001 From: nose221834 Date: Sun, 2 Jun 2024 16:26:56 +0900 Subject: [PATCH 06/22] =?UTF-8?q?k8s=E7=94=A8=E3=81=AEimage=E3=82=92?= =?UTF-8?q?=E4=BD=9C=E6=88=90=E3=81=99=E3=82=8BDockerile=E3=82=92=E4=BD=9C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin.k8s.Dockerfile | 37 +++++++++++++++++++++++++++++++++++++ api.k8s.Dockerfile | 8 ++++++++ 2 files changed, 45 insertions(+) create mode 100644 admin.k8s.Dockerfile create mode 100644 api.k8s.Dockerfile diff --git a/admin.k8s.Dockerfile b/admin.k8s.Dockerfile new file mode 100644 index 000000000..dce4458a4 --- /dev/null +++ b/admin.k8s.Dockerfile @@ -0,0 +1,37 @@ +# Stage 1: Install dependencies and build the project +FROM node:16-bookworm-slim AS builder +WORKDIR /app + +# Copy package.json and package-lock.json (or npm-shrinkwrap.json) +COPY ./admin_view/nuxt-project/package*.json ./ + +# Install dependencies +RUN npm ci + +# Copy Nuxt.js application source code +COPY ./admin_view/nuxt-project/ ./ + +# Build the application +RUN npm run build + +# Stage 2: Serve the app using a Node.js server +FROM node:16-bookworm-slim AS runner +WORKDIR /app + +# Copy the built server and client code +COPY --from=builder /app/nuxt.config.js ./nuxt.config.js +COPY --from=builder --chown=nonroot:nonroot /app/.nuxt ./.nuxt +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/package.json ./package.json +COPY --from=builder /app/package-lock.json ./package-lock.json +COPY --from=builder /app/store ./store +COPY --from=builder /app/static ./static +COPY --from=builder /app/assets ./assets +# Set environment variables +ENV NODE_ENV production + +# Expose the port the app runs on +EXPOSE 8000 + +# Start the application +CMD ["node_modules/.bin/nuxt", "start"] diff --git a/api.k8s.Dockerfile b/api.k8s.Dockerfile new file mode 100644 index 000000000..54068c179 --- /dev/null +++ b/api.k8s.Dockerfile @@ -0,0 +1,8 @@ +FROM ruby:2.7.1 +WORKDIR /myapp +ENV RAILS_ENV="production" +ENV RAILS_LOG_TO_STDOUT=ON +COPY ./api /myapp +RUN bundle install +CMD ["rails", "server", "-b", "0.0.0.0", "-p", "3000"] +EXPOSE 3000 \ No newline at end of file From 10295d8597c8ee8744f3a8e491d28617f9bb30d2 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Sun, 2 Jun 2024 17:00:39 +0900 Subject: [PATCH 07/22] =?UTF-8?q?merge=E3=81=95=E3=82=8C=E3=81=9F=E3=82=89?= =?UTF-8?q?docker=20hub=E3=81=ABpush=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/image-push.yml | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/image-push.yml diff --git a/.github/workflows/image-push.yml b/.github/workflows/image-push.yml new file mode 100644 index 000000000..1ce5f5ac3 --- /dev/null +++ b/.github/workflows/image-push.yml @@ -0,0 +1,43 @@ +name: Build and Push Multiple Docker Images + +on: + pull_request: + types: [closed] + +jobs: + build-and-push: + runs-on: ubuntu-latest + if: github.event.pull_request.merged == true + strategy: + matrix: + include: + - context: ./ + dockerfile: admin.k8s.Dockerfile + image_name: ademin_view + - context: ./ + dockerfile: front.k8s.Dockerfile + image_name: user_front + - context: ./ + dockerfile: api.k8s.Dockerfile + image_name: api + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: ${{ matrix.context }} + file: ${{ matrix.context }}/Dockerfile + push: true + tags: ${{ matrix.image_name }}:latest From 29066c0fe3d1e31086189c6ba671f5863e61e448 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Sun, 2 Jun 2024 17:09:55 +0900 Subject: [PATCH 08/22] =?UTF-8?q?=E7=89=B9=E5=AE=9A=E3=81=AE=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=8C=E5=A4=89=E6=9B=B4=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=81=9F=E5=A0=B4=E5=90=88=E3=81=AE=E3=81=BF=E5=AE=9F?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-test.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 1f2e79252..7315e6057 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -1,7 +1,12 @@ name: Docker Build and Test on: - - pull_request + pull_request: + paths: + - 'admin_view/**' + - 'user_front/**' + - 'api/**' + jobs: docker: From 91c349b93bd684af69119e0377fd7fdc9a877984 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Sun, 2 Jun 2024 17:17:24 +0900 Subject: [PATCH 09/22] =?UTF-8?q?=E3=81=84=E3=81=A5=E3=82=8Cstage=E7=92=B0?= =?UTF-8?q?=E5=A2=83=E3=81=AE=E3=81=9F=E3=82=81=E3=81=AB=E5=88=A9=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/image-push-stage.yml | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/image-push-stage.yml diff --git a/.github/workflows/image-push-stage.yml b/.github/workflows/image-push-stage.yml new file mode 100644 index 000000000..d267b701c --- /dev/null +++ b/.github/workflows/image-push-stage.yml @@ -0,0 +1,48 @@ +name: Build and Push Multiple Docker Images + +on: + pull_request: + types: [opened, synchronize, reopened, closed] + +jobs: + build-and-push: + runs-on: ubuntu-latest + if: | + github.event.pull_request.merged == true || + github.event.action == 'opened' || + github.event.action == 'synchronize' || + github.event.action == 'reopened' + strategy: + matrix: + include: + - context: ./ + dockerfile: admin.k8s.Dockerfile + image_name: ademin_view + - context: ./ + dockerfile: front.k8s.Dockerfile + image_name: user_front + - context: ./ + dockerfile: api.k8s.Dockerfile + image_name: api + + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: ${{ matrix.context }} + file: ${{ matrix.context }}/Dockerfile + push: true + tags: ${{ matrix.image_name }}:latest From a1c342c4b5e7becd6a5c0c88d069ea99a8476503 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Sun, 2 Jun 2024 17:23:53 +0900 Subject: [PATCH 10/22] =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E6=8C=87=E5=AE=9A=E6=96=B9=E6=B3=95=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/image-push-stage.yml | 16 +++++++--------- .github/workflows/image-push.yml | 16 +++++++--------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/.github/workflows/image-push-stage.yml b/.github/workflows/image-push-stage.yml index d267b701c..206243595 100644 --- a/.github/workflows/image-push-stage.yml +++ b/.github/workflows/image-push-stage.yml @@ -15,14 +15,11 @@ jobs: strategy: matrix: include: - - context: ./ - dockerfile: admin.k8s.Dockerfile - image_name: ademin_view - - context: ./ - dockerfile: front.k8s.Dockerfile + - dockerfile: admin.k8s.Dockerfile + image_name: admin_view + - dockerfile: front.k8s.Dockerfile image_name: user_front - - context: ./ - dockerfile: api.k8s.Dockerfile + - dockerfile: api.k8s.Dockerfile image_name: api @@ -42,7 +39,8 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v2 with: - context: ${{ matrix.context }} - file: ${{ matrix.context }}/Dockerfile + context: . + file: ${{ matrix.dockerfile }} push: true tags: ${{ matrix.image_name }}:latest + diff --git a/.github/workflows/image-push.yml b/.github/workflows/image-push.yml index 1ce5f5ac3..26cc686a3 100644 --- a/.github/workflows/image-push.yml +++ b/.github/workflows/image-push.yml @@ -11,14 +11,11 @@ jobs: strategy: matrix: include: - - context: ./ - dockerfile: admin.k8s.Dockerfile - image_name: ademin_view - - context: ./ - dockerfile: front.k8s.Dockerfile + - dockerfile: admin.k8s.Dockerfile + image_name: admin_view + - dockerfile: front.k8s.Dockerfile image_name: user_front - - context: ./ - dockerfile: api.k8s.Dockerfile + - dockerfile: api.k8s.Dockerfile image_name: api steps: @@ -37,7 +34,8 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v2 with: - context: ${{ matrix.context }} - file: ${{ matrix.context }}/Dockerfile + context: . + file: ${{ matrix.dockerfile }} push: true tags: ${{ matrix.image_name }}:latest + From 7f2aac1492956c52a7da1370d0e6cd9563b730ac Mon Sep 17 00:00:00 2001 From: nose221834 Date: Sun, 2 Jun 2024 17:33:18 +0900 Subject: [PATCH 11/22] =?UTF-8?q?push=E5=85=88=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/image-push-stage.yml | 6 +++--- .github/workflows/image-push.yml | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/image-push-stage.yml b/.github/workflows/image-push-stage.yml index 206243595..43808761f 100644 --- a/.github/workflows/image-push-stage.yml +++ b/.github/workflows/image-push-stage.yml @@ -16,11 +16,11 @@ jobs: matrix: include: - dockerfile: admin.k8s.Dockerfile - image_name: admin_view + image_name: nutfes/group-manager-2-admin_view - dockerfile: front.k8s.Dockerfile - image_name: user_front + image_name: nutfes/group-manager-2-user_front - dockerfile: api.k8s.Dockerfile - image_name: api + image_name: nutfes/group-manager-2-api steps: diff --git a/.github/workflows/image-push.yml b/.github/workflows/image-push.yml index 26cc686a3..5813de851 100644 --- a/.github/workflows/image-push.yml +++ b/.github/workflows/image-push.yml @@ -12,11 +12,12 @@ jobs: matrix: include: - dockerfile: admin.k8s.Dockerfile - image_name: admin_view + image_name: nutfes/group-manager-2-admin_view - dockerfile: front.k8s.Dockerfile - image_name: user_front + image_name: nutfes/group-manager-2-user_front - dockerfile: api.k8s.Dockerfile - image_name: api + image_name: nutfes/group-manager-2-api + steps: - name: Checkout code From 3e2a83ba23584579a1c228089bf9bfe91137aebd Mon Sep 17 00:00:00 2001 From: nose221834 Date: Sat, 8 Jun 2024 21:18:23 +0900 Subject: [PATCH 12/22] =?UTF-8?q?k8s=E3=81=A7=E3=81=AF=5F=E3=81=8C?= =?UTF-8?q?=E5=88=A9=E7=94=A8=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=84=E3=81=9F?= =?UTF-8?q?=E3=82=81=E3=80=81-=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/image-push-stage.yml | 4 ++-- .github/workflows/image-push.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/image-push-stage.yml b/.github/workflows/image-push-stage.yml index 43808761f..1796e6c2e 100644 --- a/.github/workflows/image-push-stage.yml +++ b/.github/workflows/image-push-stage.yml @@ -16,9 +16,9 @@ jobs: matrix: include: - dockerfile: admin.k8s.Dockerfile - image_name: nutfes/group-manager-2-admin_view + image_name: nutfes/group-manager-2-admin-view - dockerfile: front.k8s.Dockerfile - image_name: nutfes/group-manager-2-user_front + image_name: nutfes/group-manager-2-user-front - dockerfile: api.k8s.Dockerfile image_name: nutfes/group-manager-2-api diff --git a/.github/workflows/image-push.yml b/.github/workflows/image-push.yml index 5813de851..b0d14d76b 100644 --- a/.github/workflows/image-push.yml +++ b/.github/workflows/image-push.yml @@ -12,9 +12,9 @@ jobs: matrix: include: - dockerfile: admin.k8s.Dockerfile - image_name: nutfes/group-manager-2-admin_view + image_name: nutfes/group-manager-2-admin-view - dockerfile: front.k8s.Dockerfile - image_name: nutfes/group-manager-2-user_front + image_name: nutfes/group-manager-2-user-front - dockerfile: api.k8s.Dockerfile image_name: nutfes/group-manager-2-api From 394ec1c1cb773815938e6c1453acc35e4912b816 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Tue, 18 Jun 2024 23:40:14 +0900 Subject: [PATCH 13/22] =?UTF-8?q?=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0?= =?UTF-8?q?=E3=82=92build=E6=99=82=E3=81=AB=E6=B8=A1=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/image-push-stage.yml | 19 +++++++++++++++++++ admin.k8s.Dockerfile | 8 ++++++++ front.k8s.Dockerfile | 16 ++++++++++++---- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/.github/workflows/image-push-stage.yml b/.github/workflows/image-push-stage.yml index 1796e6c2e..5807707fc 100644 --- a/.github/workflows/image-push-stage.yml +++ b/.github/workflows/image-push-stage.yml @@ -17,10 +17,24 @@ jobs: include: - dockerfile: admin.k8s.Dockerfile image_name: nutfes/group-manager-2-admin-view + vue_app_url: '' + vue_app_api_url: '' + imgur_id: '' + imgur_token: '' + - dockerfile: front.k8s.Dockerfile image_name: nutfes/group-manager-2-user-front + vue_app_url: ${{ secrets.VUE_APP_URL }} + vue_app_api_url: ${{ secrets.VUE_APP_API_URL }} + imgur_id: ${{ secrets.NUXT_IMGUR_CLIENT_ID }} + imgur_token: ${{ secrets.NUXT_IMGUR_CLIENT_SECRET }} + - dockerfile: api.k8s.Dockerfile image_name: nutfes/group-manager-2-api + vue_app_url: ${{ secrets.VUE_APP_URL }} + vue_app_api_url: ${{ secrets.VUE_APP_API_URL }} + imgur_id: '' + imgur_token: '' steps: @@ -43,4 +57,9 @@ jobs: file: ${{ matrix.dockerfile }} push: true tags: ${{ matrix.image_name }}:latest + build-args: | + VUE_APP_URL=${{ matrix.vue_app_url }} + VUE_APP_API_URL=${{ matrix.vue_app_api_url }} + NUXT_IMGUR_CLIENT_ID=${{ matrix.imgur_id }} + NUXT_IMGUR_CLIENT_SECRET=${{ matrix.imgur_token }} diff --git a/admin.k8s.Dockerfile b/admin.k8s.Dockerfile index dce4458a4..10bdd9f06 100644 --- a/admin.k8s.Dockerfile +++ b/admin.k8s.Dockerfile @@ -2,6 +2,14 @@ FROM node:16-bookworm-slim AS builder WORKDIR /app +# Accept API URL as a build-time environment variable +ARG API_URL +ARG APP_API_URL + +# Set the environment variable +ENV VUE_APP_URL=${API_URL} +ENV VUE_APP_API_URL=${APP_API_URL} + # Copy package.json and package-lock.json (or npm-shrinkwrap.json) COPY ./admin_view/nuxt-project/package*.json ./ diff --git a/front.k8s.Dockerfile b/front.k8s.Dockerfile index 1b8b4d338..810c730b8 100644 --- a/front.k8s.Dockerfile +++ b/front.k8s.Dockerfile @@ -2,13 +2,23 @@ FROM node:18-bookworm-slim AS builder WORKDIR /app +# Accept API URL as a build-time environment variable +ARG API_URL +ARG APP_API_URL +ARG IMGUR_ID +ARG IMGUR_SECRET + +# Set the environment variable +ENV VUE_APP_URL=${API_URL} +ENV VUE_APP_API_URL=${APP_API_URL} +ENV NUXT_IMGUR_CLIENT_ID=${IMGUR_ID} +ENV NUXT_IMGUR_CLIENT_SECRET=${IMGUR_SECRET} + # Install postinstall necessary for Nuxt 3 COPY ./user_front/package*.json ./ RUN npm ci - # Copy the rest of your Vue.js application source code COPY ./user_front/ ./ - # Build the application RUN npm run build @@ -18,11 +28,9 @@ WORKDIR /app # Copy the built server and client code COPY --from=builder /app/.output ./output - # Set environment variables ENV NODE_ENV production - # Expose the port the app runs on EXPOSE 3000 From 078b8df84bcba1b4e2a24cad8e8ff23cae8f7e82 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Tue, 18 Jun 2024 23:46:39 +0900 Subject: [PATCH 14/22] =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E3=81=AE=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/image-push-stage.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/image-push-stage.yml b/.github/workflows/image-push-stage.yml index 5807707fc..3b52b495b 100644 --- a/.github/workflows/image-push-stage.yml +++ b/.github/workflows/image-push-stage.yml @@ -7,11 +7,7 @@ on: jobs: build-and-push: runs-on: ubuntu-latest - if: | - github.event.pull_request.merged == true || - github.event.action == 'opened' || - github.event.action == 'synchronize' || - github.event.action == 'reopened' + if: github.event_name == 'pull_request' strategy: matrix: include: From 7b43aa0e3f30c6b724c7a726299387f200a56474 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Tue, 18 Jun 2024 23:59:37 +0900 Subject: [PATCH 15/22] =?UTF-8?q?=E3=83=AF=E3=83=BC=E3=82=AF=E3=83=95?= =?UTF-8?q?=E3=83=AD=E3=83=BC=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/image-push-stage.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/image-push-stage.yml b/.github/workflows/image-push-stage.yml index 3b52b495b..0dcdf1641 100644 --- a/.github/workflows/image-push-stage.yml +++ b/.github/workflows/image-push-stage.yml @@ -34,8 +34,10 @@ jobs: steps: - - name: Checkout code - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + + - name: Checkout repository + uses: actions/checkout@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 From 53b48bc0251e4dd5cdb1d68d0b4f55c9ea9497d1 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Wed, 19 Jun 2024 00:02:10 +0900 Subject: [PATCH 16/22] =?UTF-8?q?if=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/image-push-stage.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/image-push-stage.yml b/.github/workflows/image-push-stage.yml index 0dcdf1641..f6a8076a4 100644 --- a/.github/workflows/image-push-stage.yml +++ b/.github/workflows/image-push-stage.yml @@ -7,7 +7,6 @@ on: jobs: build-and-push: runs-on: ubuntu-latest - if: github.event_name == 'pull_request' strategy: matrix: include: From ce5fa81bd0e7fc268ced2cf66d4dadae95e4fcd0 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Wed, 19 Jun 2024 00:08:22 +0900 Subject: [PATCH 17/22] =?UTF-8?q?matrix=E5=86=85=E3=81=A7=E3=81=AEsecrets?= =?UTF-8?q?=E3=81=AE=E5=88=A9=E7=94=A8=E3=82=92=E3=82=84=E3=82=81=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/image-push-stage.yml | 27 +++++++++----------------- 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/.github/workflows/image-push-stage.yml b/.github/workflows/image-push-stage.yml index f6a8076a4..e969617a8 100644 --- a/.github/workflows/image-push-stage.yml +++ b/.github/workflows/image-push-stage.yml @@ -7,30 +7,22 @@ on: jobs: build-and-push: runs-on: ubuntu-latest + if: | + github.event.pull_request.merged == true || + github.event.action == 'opened' || + github.event.action == 'synchronize' || + github.event.action == 'reopened' strategy: matrix: include: - dockerfile: admin.k8s.Dockerfile image_name: nutfes/group-manager-2-admin-view - vue_app_url: '' - vue_app_api_url: '' - imgur_id: '' - imgur_token: '' - dockerfile: front.k8s.Dockerfile image_name: nutfes/group-manager-2-user-front - vue_app_url: ${{ secrets.VUE_APP_URL }} - vue_app_api_url: ${{ secrets.VUE_APP_API_URL }} - imgur_id: ${{ secrets.NUXT_IMGUR_CLIENT_ID }} - imgur_token: ${{ secrets.NUXT_IMGUR_CLIENT_SECRET }} - dockerfile: api.k8s.Dockerfile image_name: nutfes/group-manager-2-api - vue_app_url: ${{ secrets.VUE_APP_URL }} - vue_app_api_url: ${{ secrets.VUE_APP_API_URL }} - imgur_id: '' - imgur_token: '' - steps: - uses: actions/checkout@v4 @@ -55,8 +47,7 @@ jobs: push: true tags: ${{ matrix.image_name }}:latest build-args: | - VUE_APP_URL=${{ matrix.vue_app_url }} - VUE_APP_API_URL=${{ matrix.vue_app_api_url }} - NUXT_IMGUR_CLIENT_ID=${{ matrix.imgur_id }} - NUXT_IMGUR_CLIENT_SECRET=${{ matrix.imgur_token }} - + VUE_APP_URL=${{ secrets.VUE_APP_URL }} + VUE_APP_API_URL=${{ secrets.VUE_APP_API_URL }} + NUXT_IMGUR_CLIENT_ID=${{ secrets.NUXT_IMGUR_CLIENT_ID }} + NUXT_IMGUR_CLIENT_SECRET=${{ secrets.NUXT_IMGUR_CLIENT_SECRET }} From a504a33127ff2edf2c57c2746b6271fba10077b5 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Wed, 19 Jun 2024 00:29:18 +0900 Subject: [PATCH 18/22] =?UTF-8?q?=E6=9C=AC=E7=95=AA=E7=94=A8=E3=81=AE?= =?UTF-8?q?=E3=83=AF=E3=83=BC=E3=82=AF=E3=83=95=E3=83=AD=E3=83=BC=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/image-push.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/image-push.yml b/.github/workflows/image-push.yml index b0d14d76b..958eadf47 100644 --- a/.github/workflows/image-push.yml +++ b/.github/workflows/image-push.yml @@ -20,8 +20,10 @@ jobs: steps: - - name: Checkout code - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + + - name: Checkout repository + uses: actions/checkout@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 @@ -39,4 +41,10 @@ jobs: file: ${{ matrix.dockerfile }} push: true tags: ${{ matrix.image_name }}:latest + build-args: | + VUE_APP_URL=${{ secrets.VUE_APP_URL }} + VUE_APP_API_URL=${{ secrets.VUE_APP_API_URL }} + NUXT_IMGUR_CLIENT_ID=${{ secrets.NUXT_IMGUR_CLIENT_ID }} + NUXT_IMGUR_CLIENT_SECRET=${{ secrets.NUXT_IMGUR_CLIENT_SECRET }} + From fca42fdf08fcf4b63afd261b1fdacac3e1db54e3 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Wed, 19 Jun 2024 16:13:53 +0900 Subject: [PATCH 19/22] =?UTF-8?q?dockerfile=E3=81=AB=E6=B8=A1=E3=81=99?= =?UTF-8?q?=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/image-push-stage.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/image-push-stage.yml b/.github/workflows/image-push-stage.yml index e969617a8..b990c7fd5 100644 --- a/.github/workflows/image-push-stage.yml +++ b/.github/workflows/image-push-stage.yml @@ -47,7 +47,7 @@ jobs: push: true tags: ${{ matrix.image_name }}:latest build-args: | - VUE_APP_URL=${{ secrets.VUE_APP_URL }} - VUE_APP_API_URL=${{ secrets.VUE_APP_API_URL }} - NUXT_IMGUR_CLIENT_ID=${{ secrets.NUXT_IMGUR_CLIENT_ID }} - NUXT_IMGUR_CLIENT_SECRET=${{ secrets.NUXT_IMGUR_CLIENT_SECRET }} + API_URL=${{ secrets.VUE_APP_URL }} + APP_API_URL=${{ secrets.VUE_APP_API_URL }} + CLIENT_ID=${{ secrets.NUXT_IMGUR_CLIENT_ID }} + CLIENT_SECRET=${{ secrets.NUXT_IMGUR_CLIENT_SECRET }} From 84443ec6442a3f67f0573890004c30c2821232f4 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Wed, 19 Jun 2024 16:45:41 +0900 Subject: [PATCH 20/22] =?UTF-8?q?=E8=87=AA=E5=88=86=E3=81=AE=E7=92=B0?= =?UTF-8?q?=E5=A2=83=E3=81=A7=E8=A9=A6=E3=81=99=E3=81=9F=E3=82=81=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/image-push-stage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/image-push-stage.yml b/.github/workflows/image-push-stage.yml index b990c7fd5..3ae134d83 100644 --- a/.github/workflows/image-push-stage.yml +++ b/.github/workflows/image-push-stage.yml @@ -47,7 +47,7 @@ jobs: push: true tags: ${{ matrix.image_name }}:latest build-args: | - API_URL=${{ secrets.VUE_APP_URL }} - APP_API_URL=${{ secrets.VUE_APP_API_URL }} + API_URL=https://group-manager-api.nosse.net + APP_API_URL=https://group-manager-api.nosse.net CLIENT_ID=${{ secrets.NUXT_IMGUR_CLIENT_ID }} CLIENT_SECRET=${{ secrets.NUXT_IMGUR_CLIENT_SECRET }} From 3f187630636d3d78eb50f4a0ca77d63294bdbdec Mon Sep 17 00:00:00 2001 From: nose221834 Date: Wed, 23 Oct 2024 20:22:50 +0900 Subject: [PATCH 21/22] =?UTF-8?q?=E3=83=AA=E3=83=9D=E3=82=B8=E3=83=88?= =?UTF-8?q?=E3=83=AA=E5=90=8D=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/image-push-stage.yml | 6 +++--- .github/workflows/image-push.yml | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/image-push-stage.yml b/.github/workflows/image-push-stage.yml index 3ae134d83..9024c0a34 100644 --- a/.github/workflows/image-push-stage.yml +++ b/.github/workflows/image-push-stage.yml @@ -16,13 +16,13 @@ jobs: matrix: include: - dockerfile: admin.k8s.Dockerfile - image_name: nutfes/group-manager-2-admin-view + image_name: nose0118/group-manager-2-admin-view - dockerfile: front.k8s.Dockerfile - image_name: nutfes/group-manager-2-user-front + image_name: nose0118/group-manager-2-user-front - dockerfile: api.k8s.Dockerfile - image_name: nutfes/group-manager-2-api + image_name: nose0118/group-manager-2-api steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/image-push.yml b/.github/workflows/image-push.yml index 958eadf47..e7d9380b9 100644 --- a/.github/workflows/image-push.yml +++ b/.github/workflows/image-push.yml @@ -12,12 +12,11 @@ jobs: matrix: include: - dockerfile: admin.k8s.Dockerfile - image_name: nutfes/group-manager-2-admin-view + image_name: nose0118/group-manager-2-admin-view - dockerfile: front.k8s.Dockerfile - image_name: nutfes/group-manager-2-user-front + image_name: nose0118/group-manager-2-user-front - dockerfile: api.k8s.Dockerfile - image_name: nutfes/group-manager-2-api - + image_name: nose0118/group-manager-2-api steps: - uses: actions/checkout@v4 @@ -46,5 +45,3 @@ jobs: VUE_APP_API_URL=${{ secrets.VUE_APP_API_URL }} NUXT_IMGUR_CLIENT_ID=${{ secrets.NUXT_IMGUR_CLIENT_ID }} NUXT_IMGUR_CLIENT_SECRET=${{ secrets.NUXT_IMGUR_CLIENT_SECRET }} - - From c5828b499a2bc6d7ec99e1d9252cf9b8d3ab3e91 Mon Sep 17 00:00:00 2001 From: nose221834 Date: Wed, 23 Oct 2024 20:29:27 +0900 Subject: [PATCH 22/22] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/image-push-stage.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/image-push-stage.yml b/.github/workflows/image-push-stage.yml index 9024c0a34..7d45efe08 100644 --- a/.github/workflows/image-push-stage.yml +++ b/.github/workflows/image-push-stage.yml @@ -47,7 +47,7 @@ jobs: push: true tags: ${{ matrix.image_name }}:latest build-args: | - API_URL=https://group-manager-api.nosse.net - APP_API_URL=https://group-manager-api.nosse.net - CLIENT_ID=${{ secrets.NUXT_IMGUR_CLIENT_ID }} - CLIENT_SECRET=${{ secrets.NUXT_IMGUR_CLIENT_SECRET }} + VUE_APP_URL=${{ secrets.VUE_APP_URL }} + VUE_APP_API_URL=${{ secrets.VUE_APP_API_URL }} + NUXT_IMGUR_CLIENT_ID=${{ secrets.NUXT_IMGUR_CLIENT_ID }} + NUXT_IMGUR_CLIENT_SECRET=${{ secrets.NUXT_IMGUR_CLIENT_SECRET }}