<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bryan</title>
    <description>The latest articles on DEV Community by Bryan (@singee).</description>
    <link>https://dev.to/singee</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1070520%2Fa4474ea2-7b14-4703-b80a-f5c9bbf418df.jpeg</url>
      <title>DEV Community: Bryan</title>
      <link>https://dev.to/singee</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/singee"/>
    <language>en</language>
    <item>
      <title>Deploy windmill on Fly.io</title>
      <dc:creator>Bryan</dc:creator>
      <pubDate>Wed, 02 Aug 2023 14:22:22 +0000</pubDate>
      <link>https://dev.to/singee/deploy-windmill-on-flyio-3ii3</link>
      <guid>https://dev.to/singee/deploy-windmill-on-flyio-3ii3</guid>
      <description>&lt;p&gt;&lt;a href="https://windmill.dev"&gt;Windmill&lt;/a&gt; is an open-source, self-hosted workflow engine (even a low-code platform) that you can deploy yourself. You can visit &lt;a href="https://www.windmill.dev/docs/compared_to"&gt;https://www.windmill.dev/docs/compared_to&lt;/a&gt; to see the official comparison with services like Zapier.&lt;/p&gt;

&lt;p&gt;This article will show you how to deploy Windmill to &lt;a href="https://fly.io"&gt;Fly.io&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;This article covers two ways to deploy Windmill, which I refer to as the &lt;em&gt;minimal&lt;/em&gt; and &lt;em&gt;full&lt;/em&gt; modes.&lt;/p&gt;

&lt;p&gt;In the minimal mode, all Windmill components run in a single app. This is the simplest and most cost-effective solution, but it is not as flexible (for example, because the Server and Worker run in the same container, it is difficult to scale them horizontally). &lt;br&gt;
In the full mode, the Windmill components are split into two separate apps: the Server and the Worker. This is more complex than the minimal mode but allows for more control over the distributed Workers.&lt;/p&gt;

&lt;p&gt;Please clone the repository &lt;a href="https://github.com/imsingee/windmill-on-fly"&gt;windmill-on-fly&lt;/a&gt; and follow the steps below.&lt;/p&gt;

&lt;h2&gt;
  
  
  LSP Component
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;LSP needs to be installed in both the minimal and full modes&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;LSP provides code completion functionality on the Windmill frontend. It needs to be deployed separately.&lt;/p&gt;

&lt;h3&gt;
  
  
  Launch &amp;amp; Deploy
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;To change the region, modify the &lt;code&gt;primary_region&lt;/code&gt; field in the &lt;code&gt;fly.toml&lt;/code&gt; file (default is &lt;code&gt;sea&lt;/code&gt;). If you change the region, keeping the region consistent for all apps for optimal experience is recommended.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Navigate to the &lt;code&gt;lsp&lt;/code&gt; directory and run &lt;code&gt;fly launch&lt;/code&gt; to start the project. When prompted with &lt;code&gt;Would you like to copy its configuration to the new app? (y/N)&lt;/code&gt;, choose &lt;code&gt;Y&lt;/code&gt; and give the app a name.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Replace &lt;code&gt;my-windmill-lsp&lt;/code&gt; with the app name you set here in the subsequent steps.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the following prompts, &lt;strong&gt;do not&lt;/strong&gt; create the PostgreSQL and Redis services (choose &lt;code&gt;N&lt;/code&gt; for all related prompts).&lt;/p&gt;

&lt;p&gt;When asked &lt;code&gt;Would you like to deploy now? (y/N)&lt;/code&gt;, choose &lt;code&gt;Y&lt;/code&gt; to proceed with the deployment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Allocate IP
&lt;/h3&gt;

&lt;p&gt;After the deployment is completed, run &lt;code&gt;fly ips allocate-v6 --private&lt;/code&gt; to assign a private IP to the service (you can also remove all public IPs).&lt;/p&gt;

&lt;h3&gt;
  
  
  Scale
&lt;/h3&gt;

&lt;p&gt;LSP has higher performance requirements. Based on my experience, I recommend allocating at least 4GB of memory to it for normal usage. You can run &lt;code&gt;fly scale vm performance-2x&lt;/code&gt; to scale it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To save costs, you can enable &lt;code&gt;auto_start_machines=true&lt;/code&gt; and &lt;code&gt;auto_stop_machines=true&lt;/code&gt; in the &lt;code&gt;fly.toml&lt;/code&gt; file.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Deploy in Minimal Mode
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Skip this step if you choose the full mode.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;All the following operations are performed in the &lt;code&gt;minimal&lt;/code&gt; directory.&lt;/p&gt;

&lt;h3&gt;
  
  
  Launch
&lt;/h3&gt;

&lt;p&gt;Run &lt;code&gt;fly launch&lt;/code&gt; to start the project. When prompted with &lt;code&gt;Would you like to copy its configuration to the new app? (y/N)&lt;/code&gt;, choose &lt;code&gt;Y&lt;/code&gt; and give the app a name.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Replace &lt;code&gt;my-windmill&lt;/code&gt; with the app name you set here in the subsequent steps.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the following prompts, &lt;strong&gt;do not&lt;/strong&gt; create the PostgreSQL and Redis services (choose &lt;code&gt;N&lt;/code&gt; for all related prompts).&lt;/p&gt;

&lt;p&gt;When asked &lt;code&gt;Would you like to deploy now? (y/N)&lt;/code&gt;, choose &lt;code&gt;N&lt;/code&gt; to skip the deployment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configure the Database
&lt;/h3&gt;

&lt;p&gt;Follow the &lt;a href="https://fly.io/docs/postgres/"&gt;Fly Postgres tutorial&lt;/a&gt; to create a database cluster.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Replace &lt;code&gt;my-pg&lt;/code&gt; in the following commands with the name of your database cluster.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Run &lt;code&gt;fly pg attach my-pg --superuser&lt;/code&gt; to create the database and user.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configure LSP
&lt;/h3&gt;

&lt;p&gt;Edit the &lt;code&gt;Caddyfile&lt;/code&gt; and replace &lt;code&gt;xxx-windmill-lsp&lt;/code&gt; with the name of your windmill-lsp service.&lt;/p&gt;

&lt;h3&gt;
  
  
  (Optional) Bind Custom Domain
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Skip this step if you don't have or don't want to bind a custom domain.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Run &lt;code&gt;fly certs add YOUR_DOMAIN&lt;/code&gt; to configure a custom domain (replace &lt;code&gt;YOUR_DOMAIN&lt;/code&gt; with your domain) and configure the required CNAME record as instructed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configure Environment Variables
&lt;/h3&gt;

&lt;p&gt;Open the &lt;code&gt;fly.toml&lt;/code&gt; file and modify &lt;code&gt;env.BASE_URL&lt;/code&gt; to your external access domain. If you're not using a custom domain, enter &lt;code&gt;https://my-windmill.fly.dev&lt;/code&gt; here; otherwise, enter &lt;code&gt;https://YOUR_DOMAIN&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you want to modify the number of workers, you can change the value of the &lt;code&gt;env.NUM_WORKERS&lt;/code&gt; variable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deploy
&lt;/h3&gt;

&lt;p&gt;Run &lt;code&gt;fly deploy&lt;/code&gt; to deploy the application (the deployment process will automatically build the required images and create the necessary volumes). Wait for the deployment to complete successfully and then access your instance to test logging in using the account &lt;code&gt;admin@windmill.dev&lt;/code&gt; and password &lt;code&gt;changeme&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploy in Full Mode
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Skip this step if you choose the minimal mode.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The &lt;code&gt;full&lt;/code&gt; directory includes two subdirectories: &lt;code&gt;server&lt;/code&gt; and &lt;code&gt;worker&lt;/code&gt;, which store the configurations for the Server and Worker components, respectively.&lt;/p&gt;

&lt;h3&gt;
  
  
  Server - Launch
&lt;/h3&gt;

&lt;p&gt;Navigate to the &lt;code&gt;full/server&lt;/code&gt; directory and run &lt;code&gt;fly launch&lt;/code&gt; to start the project. When prompted with &lt;code&gt;Would you like to copy its configuration to the new app? (y/N)&lt;/code&gt;, choose &lt;code&gt;Y&lt;/code&gt; and give the app a name.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Replace &lt;code&gt;my-windmill-server&lt;/code&gt; with the app name you set in the subsequent steps.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the following prompts, &lt;strong&gt;do not&lt;/strong&gt; create the PostgreSQL and Redis services (choose &lt;code&gt;N&lt;/code&gt; for all related prompts).&lt;/p&gt;

&lt;p&gt;When asked &lt;code&gt;Would you like to deploy now? (y/N)&lt;/code&gt;, choose &lt;code&gt;N&lt;/code&gt; to skip the deployment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Server - Configure the Database
&lt;/h3&gt;

&lt;p&gt;Follow the &lt;a href="https://fly.io/docs/postgres/"&gt;Fly Postgres tutorial&lt;/a&gt; to create a database cluster.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Replace &lt;code&gt;my-pg&lt;/code&gt; in the following commands with the name of your database cluster. Use &lt;code&gt;windmill&lt;/code&gt; as the &lt;code&gt;database-name&lt;/code&gt; and &lt;code&gt;database-user&lt;/code&gt; in the commands, or modify them to your desired names.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Navigate to the &lt;code&gt;full/server&lt;/code&gt; directory and run &lt;code&gt;fly pg attach my-pg --superuser --database-name windmill --database-user windmill&lt;/code&gt; to create the database and user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Take note of the DATABASE_URL printed during the execution of the above command for later use.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Server - Configure LSP
&lt;/h3&gt;

&lt;p&gt;Navigate to the &lt;code&gt;full/server&lt;/code&gt; directory and edit the &lt;code&gt;Caddyfile&lt;/code&gt;. Replace &lt;code&gt;xxx-windmill-lsp&lt;/code&gt; with the name of your windmill-lsp service.&lt;/p&gt;

&lt;h3&gt;
  
  
  (Optional) Server - Bind Custom Domain
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Skip this step if you don't have or don't want to bind a custom domain.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Navigate to the &lt;code&gt;full/server&lt;/code&gt; directory and run &lt;code&gt;fly certs add YOUR_DOMAIN&lt;/code&gt; to configure a custom domain (replace &lt;code&gt;YOUR_DOMAIN&lt;/code&gt; with your domain) and configure the required CNAME record as instructed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Server - Configure Environment Variables
&lt;/h3&gt;

&lt;p&gt;Navigate to the &lt;code&gt;full/server&lt;/code&gt; directory and open the &lt;code&gt;fly.toml&lt;/code&gt; file. Modify &lt;code&gt;env.BASE_URL&lt;/code&gt; to your external access domain. If you're not using a custom domain, enter &lt;code&gt;https://my-windmill-server.fly.dev&lt;/code&gt; here; otherwise, enter &lt;code&gt;https://YOUR_DOMAIN&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Server - Deploy
&lt;/h3&gt;

&lt;p&gt;Navigate to the &lt;code&gt;full/server&lt;/code&gt; directory and run &lt;code&gt;fly deploy&lt;/code&gt; to deploy the server (the deployment process will automatically build the required images and create the necessary volumes).&lt;/p&gt;

&lt;p&gt;By default, the new version of a fly app without volumes will deploy two instances. For the Server, multiple instances are usually unnecessary. You can run &lt;code&gt;fly scale count 1&lt;/code&gt; to delete the extra instances.&lt;/p&gt;

&lt;p&gt;Wait for the deployment to complete successfully. Then, access your instance to test logging in using the account &lt;code&gt;admin@windmill.dev&lt;/code&gt; and password &lt;code&gt;changeme&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Worker - Launch
&lt;/h3&gt;

&lt;p&gt;Navigate to the &lt;code&gt;full/worker&lt;/code&gt; directory and run &lt;code&gt;fly launch&lt;/code&gt; to start the project. When prompted with &lt;code&gt;Would you like to copy its configuration to the new app? (y/N)&lt;/code&gt;, choose &lt;code&gt;Y&lt;/code&gt; and give the app a name.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Replace &lt;code&gt;my-windmill-worker&lt;/code&gt; with the app name you set in the subsequent steps.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the following prompts, &lt;strong&gt;do not&lt;/strong&gt; create the PostgreSQL and Redis services (choose &lt;code&gt;N&lt;/code&gt; for all related prompts).&lt;/p&gt;

&lt;p&gt;When asked &lt;code&gt;Would you like to deploy now? (y/N)&lt;/code&gt;, choose &lt;code&gt;N&lt;/code&gt; to skip the deployment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Worker - Configure the Database
&lt;/h3&gt;

&lt;p&gt;Navigate to the &lt;code&gt;full/worker&lt;/code&gt; directory and run &lt;code&gt;fly secrets set 'DATABASE_URL=xxx' --stage&lt;/code&gt; to configure the credentials for connecting to the database. (Replace &lt;code&gt;xxx&lt;/code&gt; with the content of the DATABASE_URL printed during the previous steps).&lt;/p&gt;

&lt;h3&gt;
  
  
  Worker - Configure Environment Variables
&lt;/h3&gt;

&lt;p&gt;Navigate to the &lt;code&gt;full/worker&lt;/code&gt; directory and open the &lt;code&gt;fly.toml&lt;/code&gt; file. Modify &lt;code&gt;env.BASE_URL&lt;/code&gt; to the external access domain of your windmill-server. If you're not using a custom domain, enter &lt;code&gt;https://my-windmill-server.fly.dev&lt;/code&gt; here; otherwise, enter &lt;code&gt;https://YOUR_DOMAIN&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you want to modify the number of workers, you can change the value of the &lt;code&gt;env.NUM_WORKERS&lt;/code&gt; variable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Worker - Deploy
&lt;/h3&gt;

&lt;p&gt;Navigate to the &lt;code&gt;full/worker&lt;/code&gt; directory and run &lt;code&gt;fly deploy&lt;/code&gt; to deploy the worker.&lt;/p&gt;

&lt;p&gt;Visit your instance's &lt;code&gt;/workers&lt;/code&gt; route (e.g., &lt;code&gt;https://my-windmill-server.fly.dev/workers&lt;/code&gt;) to see if your Worker is displayed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Upgrading (or specifying a version)
&lt;/h3&gt;

&lt;p&gt;Currently, all version numbers use &lt;code&gt;latest&lt;/code&gt;, which may not be suitable for a production environment (because each redeployment will upgrade to the latest version).&lt;/p&gt;

&lt;p&gt;The version numbers are present in the following files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;lsp/fly.toml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;minimal/Dockerfile&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;full/server/Dockerfile&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;full/worker/fly.toml&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can replace &lt;code&gt;latest&lt;/code&gt; with the desired version number in these files, for example, &lt;code&gt;1.133&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The only important thing to note is to always keep all version numbers consistent; otherwise, there may be unknown issues.&lt;/p&gt;

&lt;p&gt;To upgrade: Modify the version number and redeploy using &lt;code&gt;fly deploy&lt;/code&gt; in the relevant directories.&lt;/p&gt;

</description>
      <category>windmill</category>
      <category>flyio</category>
    </item>
    <item>
      <title>FYI: How to Use Next.js Standalone with pnpm workspace in Docker</title>
      <dc:creator>Bryan</dc:creator>
      <pubDate>Tue, 23 May 2023 07:15:36 +0000</pubDate>
      <link>https://dev.to/singee/fyi-how-to-use-nextjs-standalone-with-pnpm-workspace-in-docker-28m3</link>
      <guid>https://dev.to/singee/fyi-how-to-use-nextjs-standalone-with-pnpm-workspace-in-docker-28m3</guid>
      <description>&lt;p&gt;Based on &lt;a href="https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile"&gt;official Dockerfile&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy these files&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;./pkg/xxx/.next/standalone/*&lt;/code&gt;       -&amp;gt;     &lt;code&gt;/app/pkg/xxx/*&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;./pkg/xxx/public/*&lt;/code&gt;                         -&amp;gt;     &lt;code&gt;/app/pkg/xxx/pkg/xxx/public/*&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;./pkg/xxx/.next/.next/static/*&lt;/code&gt;       -&amp;gt;     &lt;code&gt;/app/pkg/xxx/pkg/xxx/.next/static/*&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And then run &lt;code&gt;node /app/pkg/xxx/pkg/xxx/server.js&lt;/code&gt;&lt;/p&gt;




&lt;p&gt;Full Dockerfile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;node:18-alpine&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;AS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;base&lt;/span&gt;

&lt;span class="c"&gt;# Install dependencies only when needed&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;base&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;AS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;deps&lt;/span&gt;
&lt;span class="c"&gt;# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;apk add &lt;span class="nt"&gt;--no-cache&lt;/span&gt; libc6-compat
&lt;span class="k"&gt;RUN &lt;/span&gt;yarn global add pnpm

&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;

&lt;span class="c"&gt;# Install dependencies based on the preferred package manager&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; package.json pnpm-lock.yaml pnpm-workspace.yaml ./&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; pkg/xxx/package.json ./pkg/xxx/&lt;/span&gt;

&lt;span class="k"&gt;RUN &lt;/span&gt;pnpm i &lt;span class="nt"&gt;--frozen-lockfile&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;pkg/xxx &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; pnpm i &lt;span class="nt"&gt;--frozen-lockfile&lt;/span&gt;


&lt;span class="c"&gt;# Rebuild the source code only when needed&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;base&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;AS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;builder&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;

&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=deps /app/node_modules ./node_modules&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=deps /app/pkg/xxx/node_modules ./pkg/xxx/node_modules&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;

&lt;span class="c"&gt;# Next.js collects completely anonymous telemetry data about general usage.&lt;/span&gt;
&lt;span class="c"&gt;# Learn more here: https://nextjs.org/telemetry&lt;/span&gt;
&lt;span class="c"&gt;# Uncomment the following line in case you want to disable telemetry during the build.&lt;/span&gt;
&lt;span class="c"&gt;# ENV NEXT_TELEMETRY_DISABLED 1&lt;/span&gt;

&lt;span class="k"&gt;RUN &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;pkg/xxx &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; npm run build

&lt;span class="c"&gt;# Production image, copy all the files and run next&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;base&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;AS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;runner&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;

&lt;span class="k"&gt;ENV&lt;/span&gt;&lt;span class="s"&gt; NODE_ENV production&lt;/span&gt;
&lt;span class="c"&gt;# Uncomment the following line in case you want to disable telemetry during runtime.&lt;/span&gt;
&lt;span class="c"&gt;# ENV NEXT_TELEMETRY_DISABLED 1&lt;/span&gt;

&lt;span class="k"&gt;RUN &lt;/span&gt;addgroup &lt;span class="nt"&gt;--system&lt;/span&gt; &lt;span class="nt"&gt;--gid&lt;/span&gt; 1001 nodejs
&lt;span class="k"&gt;RUN &lt;/span&gt;adduser &lt;span class="nt"&gt;--system&lt;/span&gt; &lt;span class="nt"&gt;--uid&lt;/span&gt; 1001 nextjs

&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=builder --chown=nextjs:nodejs /app/pkg/xxx/.next/standalone ./pkg/xxx/&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=builder --chown=nextjs:nodejs /app/pkg/xxx/public ./pkg/xxx/pkg/xxx/public&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=builder --chown=nextjs:nodejs /app/pkg/xxx/.next/static ./pkg/xxx/pkg/xxx/.next/static&lt;/span&gt;

&lt;span class="k"&gt;USER&lt;/span&gt;&lt;span class="s"&gt; nextjs&lt;/span&gt;

&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 3000&lt;/span&gt;

&lt;span class="k"&gt;ENV&lt;/span&gt;&lt;span class="s"&gt; PORT 3000&lt;/span&gt;

&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["node", "./pkg/xxx/pkg/xxx/server.js"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
  </channel>
</rss>
