Commit d73f7dc5 by krds-arun

updated git and docker fil

parent a55c4f99
stages: stages:
- lint
- test
- build - build
- deploy - deploy
variables: variables:
app_name: maf-mp-frontend app_name: maf-gateway-frontend
app_image_tag: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME app_image_tag: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
image_tag: $CI_BUILD_REF_NAME
image: $CI_REGISTRY_IMAGE
registry_pass: $CI_BUILD_TOKEN
registry_user: gitlab-ci-token registry_user: gitlab-ci-token
registry_pass: $CI_JOB_TOKEN
registry: $CI_REGISTRY registry: $CI_REGISTRY
slack_channel: magicplanet PNPM_HOME: /root/.local/share/pnpm
ecs_definition: config/ecs-task-definition.json PATH: /root/.local/share/pnpm:$PATH
ecs_entrypoint: app:3000 FF_USE_FASTZIP: "true"
lint:
image: node:18-alpine
stage: lint
cache:
paths:
- node_modules/
- .pnpm-store/
policy: pull
script:
- corepack enable pnpm
- pnpm install --frozen-lockfile
- pnpm run lint:biome
only:
- merge_requests
- develop
- master
docker_build_staging: docker_build_staging:
tags: tags:
- docker - docker
- eu - eu
stage: build stage: build
image: docker:27-dind
services:
- docker:27-dind
variables: variables:
app_env: staging app_env: staging
app_api_url: https://magicplanet-new-api-staging.eu-staging.kacdn.net app_api_url: https://magicplanet-new-api-staging.eu-staging.kacdn.net
app_cms_url: https://maf-mp-strapi-staging.eu-staging.kacdn.net/api before_script:
app_assets_url: https://maf-mp.s3.ap-southeast-1.amazonaws.com/maf-mp-strapi/staging
script:
- env
- docker login -u $registry_user -p $registry_pass $registry - docker login -u $registry_user -p $registry_pass $registry
- docker build -t $app_image_tag script:
--build-arg APP_ENV=$app_env - docker build -t $app_image_tag .
--build-arg APP_REVALIDATE_SECRET=$app_revalidate_secret
--build-arg NEXT_PUBLIC_AUTH0_DOMAIN=$app_auth0_domain
--build-arg NEXT_PUBLIC_AUTH0_CLIENT_ID=$app_auth0_client_id
--build-arg NEXT_PUBLIC_RECAPTCHA_SITE_KEY=$app_recaptcha_site_key
--build-arg APP_CMS_URL=$app_cms_url
--build-arg APP_CMS_TOKEN=$app_cms_token
--build-arg APP_ASSETS_URL=$app_assets_url
--build-arg NEXT_PUBLIC_API_URL=$app_api_url .
- docker push $app_image_tag - docker push $app_image_tag
only: only:
- master - master
...@@ -50,9 +58,9 @@ deploy_staging: ...@@ -50,9 +58,9 @@ deploy_staging:
stage: deploy stage: deploy
variables: variables:
app_env: staging app_env: staging
# app_http_auth_path: /etc/nginx/.htpasswd_common
# app_http_auth_path: config/vhost.conf
script: script:
- deploy-ecs eu-staging - deploy-ecs eu-staging
dependencies:
- docker_build_staging
only: only:
- master - master
FROM node:18-alpine AS base FROM node:20-alpine AS base
ARG APP_ENV
ARG NEXT_PUBLIC_API_URL
ARG APP_CMS_URL
ARG APP_CMS_TOKEN
ARG APP_ASSETS_URL
ARG APP_REVALIDATE_SECRET
ARG NEXT_PUBLIC_RECAPTCHA_SITE_KEY
ENV APP_ENV=${APP_ENV}
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
ENV APP_CMS_URL=${APP_CMS_URL}
ENV APP_CMS_TOKEN=${APP_CMS_TOKEN}
ENV APP_REVALIDATE_SECRET=${APP_REVALIDATE_SECRET}
ENV NEXT_PUBLIC_RECAPTCHA_SITE_KEY=${NEXT_PUBLIC_RECAPTCHA_SITE_KEY}
ENV NEXT_TELEMETRY_DISABLED 1 ENV NEXT_TELEMETRY_DISABLED 1
ENV COREPACK_INTEGRITY_KEYS=0 ENV COREPACK_INTEGRITY_KEYS=0
...@@ -27,8 +13,7 @@ WORKDIR /app ...@@ -27,8 +13,7 @@ WORKDIR /app
# Install dependencies based on the preferred package manager # Install dependencies based on the preferred package manager
COPY package.json pnpm-lock.yaml ./ COPY package.json pnpm-lock.yaml ./
RUN corepack enable pnpm RUN corepack enable pnpm && pnpm install --frozen-lockfile --production
RUN pnpm install --production
# Rebuild the source code only when needed # Rebuild the source code only when needed
FROM base AS builder FROM base AS builder
...@@ -40,8 +25,7 @@ WORKDIR /app ...@@ -40,8 +25,7 @@ WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules COPY --from=deps /app/node_modules ./node_modules
COPY . . COPY . .
RUN corepack enable pnpm RUN corepack enable pnpm && pnpm build
RUN pnpm build
# Production image, copy all the files and run next # Production image, copy all the files and run next
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment