Skip to content

Commit

Permalink
Add Steps component to docker.mdx (#8121)
Browse files Browse the repository at this point in the history
Co-authored-by: Houston (Bot) <108291165+astrobot-houston@users.noreply.github.com>
Co-authored-by: Sergio A. Arevalo Soria <sergio.alberto.arevalo.soria@nav.no>
Co-authored-by: HiDeoo <494699+HiDeoo@users.noreply.github.com>
Co-authored-by: Reuben Tier <64310361+TheOtterlord@users.noreply.github.com>
  • Loading branch information
5 people committed May 2, 2024
1 parent 1fdcf7f commit 75d28ec
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/content/docs/en/recipes/docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ description: Learn how to build your Astro site using Docker.
type: recipe
i18nReady: true
---
import { Steps } from '@astrojs/starlight/components';

[Docker](https://docker.com) is a tool to build, deploy, and run applications using containers.

Expand Down Expand Up @@ -168,23 +169,24 @@ CMD node ./dist/server/entry.mjs

## Recipe

<Steps>
1. Build your container by running the following command in your project's root directory. Use any name for `<your-astro-image-name>`:

```bash
docker build -t <your-astro-image-name> .
```
```bash
docker build -t <your-astro-image-name> .
```

This will output an image, which you can run locally or deploy to a platform of your choice.
This will output an image, which you can run locally or deploy to a platform of your choice.

2. To run your image as a local container, use the following command.

Replace `<local-port>` with an open port on your machine. Replace `<container-port>` with the port exposed by your Docker container (`4321`, `80`, or `8080` in the above examples.)
Replace `<local-port>` with an open port on your machine. Replace `<container-port>` with the port exposed by your Docker container (`4321`, `80`, or `8080` in the above examples.)

```bash
docker run -p <local-port>:<container-port> <your-astro-image-name>
```
```bash
docker run -p <local-port>:<container-port> <your-astro-image-name>
```

You should be able to access your site at `http://localhost:<local-port>`.
You should be able to access your site at `http://localhost:<local-port>`.

3. Now that your website is successfully built and packaged in a container, you can deploy it to a cloud provider. See the [Google Cloud](/en/guides/deploy/google-cloud/#cloud-run-ssr-and-static) deployment guide for one example, and the [Deploy your app](https://docs.docker.com/language/nodejs/deploy/) page in the Docker docs.

</Steps>

0 comments on commit 75d28ec

Please sign in to comment.