Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker-compose usage #241

Closed
dartunian opened this issue Jan 14, 2021 · 8 comments
Closed

Docker-compose usage #241

dartunian opened this issue Jan 14, 2021 · 8 comments
Labels

Comments

@dartunian
Copy link

Describe the bug
Daux set-up using docker-compose. Could be my own misunderstanding, but the following results in the container outputting daux/daux.io unknown:

  daux:
    image: daux/daux.io:latest
    container_name: "daux"
    volumes:
      - ./daux:/docs

To Reproduce
Steps to reproduce the behavior:

  1. Start a Docker container using the above compose syntax.
  2. Read container output.

Expected behavior
I would expect the container to run, but instead it forces itself off and outputs daux/daux.io unknown.

Apologies if I'm missing a fundamental piece, but I've been dealing with this for hours.

@onigoetz
Copy link
Contributor

Hello,

I'm not sure to understand what you wish to do.

Let's say you want to serve your documentation, this is insufficient, as the default "daux" command will generate the documentation.

So you would need to set something like command: ["daux", "serve"]
This will start daux in daemon mode and serve the pages on the default port (8085)

But also know that this is not the recommended way to serve daux pages, as they are supposed to be generated statically, you're better off generating the documentation and serving the static files using apache/nginx. This is going to be faster than generating the page at each view.

@dartunian
Copy link
Author

dartunian commented Jan 15, 2021

Edit: I suppose I should clarify my question. Where am I supposed to mount my docs folder when trying to generate/serve?

Thank you for your quick response! My next step has been to try and generate the documentation but I am now receiving a different error.
I mount my 'docs' folder to system, and attempt pass daux generate on it like so:

  daux:
    build:
      context: .
      dockerfile: dockerfile.daux
    container_name: "daux"
    volumes:
      - ./daux:/docs
FROM daux/daux.io:latest
CMD ["daux", "generate"]

I receive the error The Docs directory does not exist. Check the path again : docs

In this case, I am unsure if I am properly mounting my docs folder.

@onigoetz
Copy link
Contributor

I would go another way to generate and serve the documentation:

With this multi-staged build : (first it generates the static documentation, then puts it in an nginx server to serve on port 80)

# Stage 1 - the build process
FROM node:7.10 as build-deps
WORKDIR /build
COPY daux /build/docs
RUN daux generate

# Stage 2 - the production environment
FROM nginx:1.12-alpine
COPY --from=build-deps /build/static /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

With the docker-compose configuration

  daux:
    build:
      context: .
      dockerfile: dockerfile.daux
    container_name: "daux"

@onigoetz
Copy link
Contributor

Note that I didn't run this, there might be some small syntax errors

@dartunian
Copy link
Author

Using your dockerfile, I am still receiving the error The Docs directory does not exist. Check the path again : docs.

For some reason, it doesn't see the folder. Any idea what might be going on?

@dartunian
Copy link
Author

Bump

@onigoetz
Copy link
Contributor

I have made some tests and this is a working version:

Dockerfile

# Stage 1 - the build process
FROM daux/daux.io:0.15.1 as build-deps
WORKDIR /build
COPY docs /build/docs
RUN daux generate

# Stage 2 - the production environment
FROM nginx:1.12-alpine
COPY --from=build-deps /build/static /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

docker-compose.yml

version: "3.9"  # optional since v1.27.0
services:
  daux:
    build:
      context: .
    container_name: "daux"
    ports:
        - 8000:80

file Structure

❯ tree
.
├── Dockerfile
├── docker-compose.yml
└── docs
    ├── 00_Getting_Started.md
    └── _index.md

@onigoetz
Copy link
Contributor

onigoetz commented Mar 2, 2021

Closing because of no activity, feel free to reopen if the solution didn't work or help

@onigoetz onigoetz closed this as completed Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants