Skip to content

Commit

Permalink
[exoframe-website] Add recipe for using build args
Browse files Browse the repository at this point in the history
  • Loading branch information
yamalight committed Dec 6, 2023
1 parent 8c0f799 commit e77e4d3
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions packages/exoframe-website/docs/recipes/buildargs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
sidebar_position: 1
---

# Using Docker Build Arguments

Sometimes, you might need to pass dynamic variables to your project during build time.
One way to achieve this is through [Docker build arguments](https://docs.docker.com/build/guide/build-args/).

Exoframe supports passing build arguments via the project config.

The example below demonstrates the use of build args with a custom Dockerfile to build a Next.js project.
For a complete Dockerfile example, refer to the [Next.js docs](https://nextjs.org/docs/pages/building-your-application/deploying#docker-image).

**Dockerfile:**

```Dockerfile
# ... copy values from args to env vars so that Next.js can use them
ARG GRAPHQL_URL=http://default.endpoint.com/v1
ENV NEXT_PUBLIC_GRAPHQL_ENDPOINT=${GRAPHQL_URL}
ARG SECRET_KEY
ENV SECRET_KEY=${SECRET_KEY}

# build app
RUN npm run build

# ... rest of Dockerfile
```

**Exoframe Project Config:**

```json
{
"name": "example-buildargs-project",
"buildargs": {
"GRAPHQL_URL": "https://graphql.endpoint.com/v1",
"SECRET_KEY": "@my-secret"
}
}
```

0 comments on commit e77e4d3

Please sign in to comment.