WIP: Implemented build containerization #40

Closed
lhinderberger wants to merge 3 commits from docker-deployment into master
  1. 3
      .dockerignore
  2. 6
      Dockerfile
  3. 46
      README.md

3
.dockerignore

@ -0,0 +1,3 @@
.git/
node_modules/
_site/

6
Dockerfile

@ -0,0 +1,6 @@
FROM alpine:latest
COPY . /codeberg-docs
WORKDIR /codeberg-docs
RUN apk add --no-cache npm
RUN npm install
ENTRYPOINT ["npm", "run"]

46
README.md

@ -22,6 +22,52 @@ to have a look at the website or
to build the website to `_site`.
## Containerized Build
For building and testing this website in a container, you have the option to use the
supplied `Dockerfile`.
First, when in the source tree of this website, build the image using
```docker build -t codeberg/documentation .```
### Example: Containzerized Site Builder
You can for example create and run a container that build the site using
```bash
$ docker run \
--name codeberg-docs-builder \
--mount type=bind,source="$(pwd)"/assets,target=/codeberg-docs/assets,readonly \
--mount type=bind,source="$(pwd)"/content,target=/codeberg-docs/content,readonly \
--mount type=bind,source=TARGET_PATH,target=/codeberg-docs/_site \
codeberg/documentation build
```
where TARGET_PATH is a directory where you want the build output to go to.
You can re-build using
```docker start codeberg-docs-builder```
and TARGET_PATH will contain the newest version of the site, depending on the contents
of the `content` and `assets` directories in the sourcetree.
When updating eleventy or and files outside `content` or `assets`, please re-build
the Docker image.
### Example: Containerized Development Server
To run an auto-refreshing development server exposed at port 8080, run:
```bash
$ docker run \
--name codeberg-docs-dev-server \
--mount type=bind,source="$(pwd)"/assets,target=/codeberg-docs/assets,readonly \
--mount type=bind,source="$(pwd)"/content,target=/codeberg-docs/content,readonly \
-p 8080:8080 \
codeberg/documentation serve
```
Remember that this server is strictly for local development use and must not be exposed to the public internet!
## License and Contributors
This website (excluding bundled fonts) is licensed under CC BY-SA 4.0. See the [LICENSE](LICENSE.md) file for details.

Loading…
Cancel
Save