Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(studio): fix Docker build #1160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sour-waves-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@asyncapi/studio": patch
---

Fix Docker build for AsyncAPI Studio
12 changes: 6 additions & 6 deletions apps/studio/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN apk add --no-cache libc6-compat
RUN apk update
# Set working directory
WORKDIR /app
RUN npm install --global turbo
RUN npm install --global turbo@1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to pin the version because the config files here are not compatible with Turbo v2.

COPY . .
RUN turbo prune --scope=@asyncapi/studio --docker

Expand All @@ -21,17 +21,17 @@ ARG BASE_URL_PLACEHOLDER
RUN apk add --no-cache libc6-compat
RUN apk update
WORKDIR /app

RUN npm install --global pnpm@latest-10
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# First install the dependencies (as they change less often)

COPY .gitignore .gitignore
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/package-lock.json ./package-lock.json
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed anymore.

RUN PUPPETEER_SKIP_DOWNLOAD=true npm ci

RUN PUPPETEER_SKIP_DOWNLOAD=true pnpm install

# Build the project
COPY --from=builder /app/out/full/ .
RUN PUBLIC_URL=${BASE_URL_PLACEHOLDER} npm run build:studio
RUN PUBLIC_URL=${BASE_URL_PLACEHOLDER} NEXT_CONFIG_OUTPUT=export pnpm run build:studio
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use static HTML export so that it works with the nginx-based setup.

This has some limitations, but none of them seem to apply here at the moment.

A potential future improvement would be to re-engineer the docker setup, but I'd like to get it working again first.



FROM docker.io/library/nginx:1.25.5-alpine as runtime
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const nextConfig = {

return config;
},
output: 'standalone',
output: process.env.NEXT_CONFIG_OUTPUT ?? 'standalone',
distDir: 'build'
};

Expand Down
3 changes: 2 additions & 1 deletion apps/studio/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"./src/*",
"./public/*"
]
}
},
"types": ["cypress"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required so that the Next.js type checker is happy, see https://docs.cypress.io/app/tooling/typescript-support#Configure-tsconfigjson.

},
"include": [
"next-env.d.ts",
Expand Down
Loading