Skip to content

Instantly share code, notes, and snippets.

@apnerve
Last active September 15, 2023 17:00
Show Gist options
  • Select an option

  • Save apnerve/8c1e9192c74c32448d1325a137ad6ecf to your computer and use it in GitHub Desktop.

Select an option

Save apnerve/8c1e9192c74c32448d1325a137ad6ecf to your computer and use it in GitHub Desktop.

Revisions

  1. apnerve revised this gist Sep 15, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion base-image.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    # Simpler NextJS development environment

    Most of my NextJS projects have the same config and settings. Only thing that changes across is the `app` folder.
    So, making a base nextjs docker iamge made sense for me
    So, making a base nextjs docker image made sense for me

    Create a file called `page.js` which exports a React component

  2. apnerve revised this gist Sep 15, 2023. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion base-image.md
    Original file line number Diff line number Diff line change
    @@ -20,4 +20,11 @@ Now run
    docker run -v `pwd`:/app/app -p 3000:3000 apnerve/nextjs npm run dev
    ```

    This will run the NextJS development server accessible at `http://localhost:3000`
    This will run the NextJS development server accessible at `http://localhost:3000`

    You could also create an alias
    ```bash
    alias z="docker run -v `pwd`:/app/app -p 3000:3000 apnerve/nextjs npm run"
    ```

    and then use `z dev` (other commands also work but won't be of much use at the moment)
  3. apnerve created this gist Sep 15, 2023.
    23 changes: 23 additions & 0 deletions base-image.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    # Simpler NextJS development environment

    Most of my NextJS projects have the same config and settings. Only thing that changes across is the `app` folder.
    So, making a base nextjs docker iamge made sense for me

    Create a file called `page.js` which exports a React component

    ```JS
    export default function Home() {
    return (
    <main className="min-h-screen p-4">
    <h1>Home</h1>
    </main>
    )
    }
    ```

    Now run
    ```bash
    docker run -v `pwd`:/app/app -p 3000:3000 apnerve/nextjs npm run dev
    ```

    This will run the NextJS development server accessible at `http://localhost:3000`