fix: removing deploy with nginx env

This commit is contained in:
sriram veeraghanta 2024-05-09 21:05:51 +05:30
parent 58bf056ddb
commit 45bb1153ee
9 changed files with 45 additions and 32 deletions

View File

@ -5,17 +5,17 @@ on:
inputs: inputs:
web-build: web-build:
required: false required: false
description: 'Build Web' description: "Build Web"
type: boolean type: boolean
default: true default: true
space-build: space-build:
required: false required: false
description: 'Build Space' description: "Build Space"
type: boolean type: boolean
default: false default: false
admin-build: admin-build:
required: false required: false
description: 'Build Admin' description: "Build Admin"
type: boolean type: boolean
default: false default: false
@ -53,7 +53,7 @@ jobs:
- name: Set up Node.js - name: Set up Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: '18' node-version: "18"
- name: Install AWS cli - name: Install AWS cli
run: | run: |
sudo apt-get update sudo apt-get update
@ -89,7 +89,7 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ vars.FEATURE_PREVIEW_AWS_ACCESS_KEY_ID }} AWS_ACCESS_KEY_ID: ${{ vars.FEATURE_PREVIEW_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.FEATURE_PREVIEW_AWS_SECRET_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.FEATURE_PREVIEW_AWS_SECRET_ACCESS_KEY }}
AWS_BUCKET: ${{ vars.FEATURE_PREVIEW_AWS_BUCKET }} AWS_BUCKET: ${{ vars.FEATURE_PREVIEW_AWS_BUCKET }}
NEXT_PUBLIC_DEPLOY_WITH_NGINX: 1 NEXT_PUBLIC_SPACE_BASE_PATH: "/spaces"
NEXT_PUBLIC_API_BASE_URL: ${{ vars.FEATURE_PREVIEW_NEXT_PUBLIC_API_BASE_URL }} NEXT_PUBLIC_API_BASE_URL: ${{ vars.FEATURE_PREVIEW_NEXT_PUBLIC_API_BASE_URL }}
outputs: outputs:
do-build: ${{ needs.setup-feature-build.outputs.space-build }} do-build: ${{ needs.setup-feature-build.outputs.space-build }}
@ -98,7 +98,7 @@ jobs:
- name: Set up Node.js - name: Set up Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: '18' node-version: "18"
- name: Install AWS cli - name: Install AWS cli
run: | run: |
sudo apt-get update sudo apt-get update
@ -134,7 +134,7 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ vars.FEATURE_PREVIEW_AWS_ACCESS_KEY_ID }} AWS_ACCESS_KEY_ID: ${{ vars.FEATURE_PREVIEW_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.FEATURE_PREVIEW_AWS_SECRET_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.FEATURE_PREVIEW_AWS_SECRET_ACCESS_KEY }}
AWS_BUCKET: ${{ vars.FEATURE_PREVIEW_AWS_BUCKET }} AWS_BUCKET: ${{ vars.FEATURE_PREVIEW_AWS_BUCKET }}
NEXT_PUBLIC_DEPLOY_WITH_NGINX: 1 NEXT_PUBLIC_ADMIN_BASE_PATH: "/god-mode"
NEXT_PUBLIC_API_BASE_URL: ${{ vars.FEATURE_PREVIEW_NEXT_PUBLIC_API_BASE_URL }} NEXT_PUBLIC_API_BASE_URL: ${{ vars.FEATURE_PREVIEW_NEXT_PUBLIC_API_BASE_URL }}
outputs: outputs:
do-build: ${{ needs.setup-feature-build.outputs.admin-build }} do-build: ${{ needs.setup-feature-build.outputs.admin-build }}
@ -143,7 +143,7 @@ jobs:
- name: Set up Node.js - name: Set up Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: '18' node-version: "18"
- name: Install AWS cli - name: Install AWS cli
run: | run: |
sudo apt-get update sudo apt-get update
@ -172,7 +172,13 @@ jobs:
feature-deploy: feature-deploy:
if: ${{ always() && (needs.setup-feature-build.outputs.web-build == 'true' || needs.setup-feature-build.outputs.space-build == 'true' || needs.setup-feature-build.outputs.admin-build == 'true') }} if: ${{ always() && (needs.setup-feature-build.outputs.web-build == 'true' || needs.setup-feature-build.outputs.space-build == 'true' || needs.setup-feature-build.outputs.admin-build == 'true') }}
needs: [setup-feature-build, feature-build-web, feature-build-space, feature-build-admin] needs:
[
setup-feature-build,
feature-build-web,
feature-build-space,
feature-build-admin,
]
name: Feature Deploy name: Feature Deploy
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:

View File

@ -21,10 +21,10 @@ COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json COPY turbo.json turbo.json
ARG NEXT_PUBLIC_API_BASE_URL="" ARG NEXT_PUBLIC_API_BASE_URL=""
ARG NEXT_PUBLIC_DEPLOY_WITH_NGINX=1 ARG NEXT_PUBLIC_ADMIN_BASE_PATH="/god-mode"
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
ENV NEXT_PUBLIC_DEPLOY_WITH_NGINX=$NEXT_PUBLIC_DEPLOY_WITH_NGINX ENV NEXT_PUBLIC_ADMIN_BASE_PATH=$NEXT_PUBLIC_ADMIN_BASE_PATH
RUN yarn turbo run build --filter=admin RUN yarn turbo run build --filter=admin
@ -40,10 +40,10 @@ COPY --from=installer /app/admin/public ./admin/public
ARG NEXT_PUBLIC_API_BASE_URL="" ARG NEXT_PUBLIC_API_BASE_URL=""
ARG NEXT_PUBLIC_DEPLOY_WITH_NGINX=1 ARG NEXT_PUBLIC_ADMIN_BASE_PATH="/god-mode"
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
ENV NEXT_PUBLIC_DEPLOY_WITH_NGINX=$NEXT_PUBLIC_DEPLOY_WITH_NGINX ENV NEXT_PUBLIC_ADMIN_BASE_PATH=$NEXT_PUBLIC_ADMIN_BASE_PATH
ENV NEXT_TELEMETRY_DISABLED 1 ENV NEXT_TELEMETRY_DISABLED 1
ENV TURBO_TELEMETRY_DISABLED 1 ENV TURBO_TELEMETRY_DISABLED 1

View File

@ -3,10 +3,15 @@ RUN apk add --no-cache libc6-compat
# Set working directory # Set working directory
WORKDIR /app WORKDIR /app
COPY . . COPY . .
RUN yarn global add turbo RUN yarn global add turbo
RUN yarn install RUN yarn install
ENV NEXT_PUBLIC_ADMIN_BASE_PATH="/god-mode"
EXPOSE 3000 EXPOSE 3000
VOLUME [ "/app/node_modules", "/app/admin/node_modules" ] VOLUME [ "/app/node_modules", "/app/admin/node_modules" ]
CMD ["yarn", "dev", "--filter=admin"] CMD ["yarn", "dev", "--filter=admin"]

View File

@ -7,7 +7,7 @@ const nextConfig = {
images: { images: {
unoptimized: true, unoptimized: true,
}, },
basePath: "/god-mode", basePath: process.env.NEXT_PUBLIC_ADMIN_BASE_PATH || "",
}; };
module.exports = nextConfig; module.exports = nextConfig;

View File

@ -3,12 +3,14 @@ RUN apk add --no-cache libc6-compat
# Set working directory # Set working directory
WORKDIR /app WORKDIR /app
COPY . . COPY . .
RUN yarn global add turbo RUN yarn global add turbo
RUN yarn install RUN yarn install
EXPOSE 4000 EXPOSE 4000
ENV NEXT_PUBLIC_DEPLOY_WITH_NGINX=1
ENV NEXT_PUBLIC_SPACE_BASE_PATH="/spaces"
VOLUME [ "/app/node_modules", "/app/space/node_modules"] VOLUME [ "/app/node_modules", "/app/space/node_modules"]
CMD ["yarn","dev", "--filter=space"] CMD ["yarn","dev", "--filter=space"]

View File

@ -21,10 +21,10 @@ COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json COPY turbo.json turbo.json
ARG NEXT_PUBLIC_API_BASE_URL="" ARG NEXT_PUBLIC_API_BASE_URL=""
ARG NEXT_PUBLIC_DEPLOY_WITH_NGINX=1 ARG NEXT_PUBLIC_SPACE_BASE_PATH="/spaces"
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
ENV NEXT_PUBLIC_DEPLOY_WITH_NGINX=$NEXT_PUBLIC_DEPLOY_WITH_NGINX ENV NEXT_PUBLIC_SPACE_BASE_PATH=$NEXT_PUBLIC_SPACE_BASE_PATH
RUN yarn turbo run build --filter=space RUN yarn turbo run build --filter=space
@ -40,10 +40,10 @@ COPY --from=installer /app/space/.next ./space/.next
COPY --from=installer /app/space/public ./space/public COPY --from=installer /app/space/public ./space/public
ARG NEXT_PUBLIC_API_BASE_URL="" ARG NEXT_PUBLIC_API_BASE_URL=""
ARG NEXT_PUBLIC_DEPLOY_WITH_NGINX=1 ARG NEXT_PUBLIC_SPACE_BASE_PATH="/spaces"
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
ENV NEXT_PUBLIC_DEPLOY_WITH_NGINX=$NEXT_PUBLIC_DEPLOY_WITH_NGINX ENV NEXT_PUBLIC_SPACE_BASE_PATH=$NEXT_PUBLIC_SPACE_BASE_PATH
COPY start.sh /usr/local/bin/ COPY start.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/start.sh RUN chmod +x /usr/local/bin/start.sh

View File

@ -5,17 +5,18 @@ const { withSentryConfig } = require("@sentry/nextjs");
const nextConfig = { const nextConfig = {
trailingSlash: true, trailingSlash: true,
output: "standalone",
basePath: process.env.NEXT_PUBLIC_SPACE_BASE_PATH || "",
reactStrictMode: false,
swcMinify: true,
async headers() { async headers() {
return [ return [
{ {
source: "/", source: "/",
headers: [{ key: "X-Frame-Options", value: "SAMEORIGIN" }], headers: [{ key: "X-Frame-Options", value: "SAMEORIGIN" }], // clickjacking protection
}, },
]; ];
}, },
basePath: "/spaces",
reactStrictMode: false,
swcMinify: true,
images: { images: {
remotePatterns: [ remotePatterns: [
{ {
@ -25,7 +26,6 @@ const nextConfig = {
], ],
unoptimized: true, unoptimized: true,
}, },
output: "standalone",
}; };
if (parseInt(process.env.NEXT_PUBLIC_ENABLE_SENTRY || "0", 10)) { if (parseInt(process.env.NEXT_PUBLIC_ENABLE_SENTRY || "0", 10)) {

View File

@ -17,7 +17,7 @@ import { AuthWrapper } from "@/lib/wrappers";
import ProfileSetupDark from "public/onboarding/profile-setup-dark.svg"; import ProfileSetupDark from "public/onboarding/profile-setup-dark.svg";
import ProfileSetup from "public/onboarding/profile-setup.svg"; import ProfileSetup from "public/onboarding/profile-setup.svg";
const imagePrefix = Boolean(parseInt(process.env.NEXT_PUBLIC_DEPLOY_WITH_NGINX || "0")) ? "/spaces" : ""; const imagePrefix = process.env.NEXT_PUBLIC_SPACE_BASE_PATH || "";
const OnBoardingPage = observer(() => { const OnBoardingPage = observer(() => {
// router // router

View File

@ -15,11 +15,11 @@
"NEXT_PUBLIC_ENABLE_SESSION_RECORDER", "NEXT_PUBLIC_ENABLE_SESSION_RECORDER",
"NEXT_PUBLIC_SESSION_RECORDER_KEY", "NEXT_PUBLIC_SESSION_RECORDER_KEY",
"NEXT_PUBLIC_EXTRA_IMAGE_DOMAINS", "NEXT_PUBLIC_EXTRA_IMAGE_DOMAINS",
"NEXT_PUBLIC_DEPLOY_WITH_NGINX",
"NEXT_PUBLIC_POSTHOG_KEY", "NEXT_PUBLIC_POSTHOG_KEY",
"NEXT_PUBLIC_POSTHOG_HOST", "NEXT_PUBLIC_POSTHOG_HOST",
"NEXT_PUBLIC_POSTHOG_DEBUG", "NEXT_PUBLIC_POSTHOG_DEBUG",
"SENTRY_AUTH_TOKEN" "SENTRY_AUTH_TOKEN",
"NEXT_PUBLIC_SPACE_BASE_PATH"
], ],
"pipeline": { "pipeline": {
"build": { "build": {