Skip to content

Commit

Permalink
Run docs in docker compose (okteto#689)
Browse files Browse the repository at this point in the history
* add a docker compose file to develop and run the docs on okteto
  • Loading branch information
rberrelleza authored Apr 3, 2024
1 parent 0fd9e79 commit e3dc529
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
build
.docusaurus
.github
Dockerfile
4 changes: 4 additions & 0 deletions .oktetodeployignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
build
.docusaurus
.github
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Dockerfile.buildkit
# syntax=docker/dockerfile:1.7-labs

FROM node:20
FROM node:20 as dev

WORKDIR /app

COPY package.json yarn.lock ./
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install

COPY . .
COPY --exclude=nginx . .
RUN --mount=type=cache,target=./node_modules/.cache/webpack yarn build

FROM bitnami/nginx as prod
COPY nginx/index.html /app
COPY --from=dev /app/build/docs /app/docs
6 changes: 6 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
docs:
build:
context: .
ports:
- "8080:8080"
3 changes: 3 additions & 0 deletions nginx/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<head>
<meta http-equiv='refresh' content='0; URL=/docs'>
</head>
10 changes: 6 additions & 4 deletions okteto.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
name: docs

build:
docs:
dev:
context: .
target: dev

deploy:
compose: docker-compose.yaml

dev:
docs:
image: ${OKTETO_BUILD_DOCS_IMAGE}
image: ${OKTETO_BUILD_DEV_IMAGE}
sync:
- .:/app
workdir: /app
command: "yarn start"
autocreate: true
forward:
- 8081:8080
- 8080:8080

0 comments on commit e3dc529

Please sign in to comment.