codeberg-Documentation/README.md
Javier Pérez 9a4e3cdc27 Fix the Dockerfile (#630)
# Changelog

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## Added

- Ignore the `.pnpm-store` directory generated by the `pnpm` package manager.
- Make the `eleventy` command render changes incrementally when in dev ("serve") mode.

## Changed

- Rename the npm script `serve` to `dev` to improve clarity.
- Update documentation to reflect new npm script name and Dockerfile volume mount point.

## Fixed

- Update the `Dockerfile` to fix errors when building the documentation container.

---

## 1st problem

The current version of the `README.md` tells to run this command:

`docker build -t Codeberg/Documentation-server .`

Unfortunately, it returns this error:

```bash
docker build -t Codeberg/Documentation-server .
[+] Building 0.0s (0/0) docker:default
ERROR: invalid tag "Codeberg/Documentation-server": repository name must be lowercase
```

## 2nd problem

If you try to build an image with the current version of `Dockerfile`, this error occurs:

```bash
[+] Building 2.7s (5/10)                                docker:default
 => [internal] load build definition from Dockerfile              0.0s
 => => transferring dockerfile: 409B                              0.0s
 => [internal] load metadata for docker.io/library/node:16.15.1-  1.1s
 => [internal] load .dockerignore                                 0.0s
 => => transferring context: 2B                                   0.0s
 => CACHED [1/7] FROM docker.io/library/node:16.15.1-stretch-sli  0.0s
 => ERROR [2/7] RUN apt-get update && apt-get -y upgrade          1.4s
------
 > [2/7] RUN apt-get update && apt-get -y upgrade:
0.235 Ign:1 http://security.debian.org/debian-security stretch/updates InRelease
0.278 Ign:2 http://security.debian.org/debian-security stretch/updates Release
0.280 Ign:3 http://deb.debian.org/debian stretch InRelease
0.293 Ign:4 http://security.debian.org/debian-security stretch/updates/main all Packages
0.308 Ign:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
0.320 Ign:6 http://deb.debian.org/debian stretch-updates InRelease
0.323 Ign:4 http://security.debian.org/debian-security stretch/updates/main all Packages
0.339 Ign:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
0.356 Ign:4 http://security.debian.org/debian-security stretch/updates/main all Packages
0.363 Ign:7 http://deb.debian.org/debian stretch Release
0.378 Ign:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
0.408 Ign:4 http://security.debian.org/debian-security stretch/updates/main all Packages
0.415 Ign:8 http://deb.debian.org/debian stretch-updates Release
0.441 Ign:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
0.463 Ign:9 http://deb.debian.org/debian stretch/main amd64 Packages
0.465 Ign:4 http://security.debian.org/debian-security stretch/updates/main all Packages
0.482 Ign:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
0.496 Ign:4 http://security.debian.org/debian-security stretch/updates/main all Packages
0.503 Ign:10 http://deb.debian.org/debian stretch/main all Packages
0.511 Err:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
0.511   404  Not Found [IP: 151.101.2.132 80]
0.542 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
0.583 Ign:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
0.623 Ign:9 http://deb.debian.org/debian stretch/main amd64 Packages
0.662 Ign:10 http://deb.debian.org/debian stretch/main all Packages
0.701 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
0.741 Ign:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
0.781 Ign:9 http://deb.debian.org/debian stretch/main amd64 Packages
0.825 Ign:10 http://deb.debian.org/debian stretch/main all Packages
0.872 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
0.912 Ign:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
0.953 Ign:9 http://deb.debian.org/debian stretch/main amd64 Packages
0.994 Ign:10 http://deb.debian.org/debian stretch/main all Packages
1.033 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
1.073 Ign:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
1.112 Ign:9 http://deb.debian.org/debian stretch/main amd64 Packages
1.152 Ign:10 http://deb.debian.org/debian stretch/main all Packages
1.193 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
1.233 Ign:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
1.274 Err:9 http://deb.debian.org/debian stretch/main amd64 Packages
1.274   404  Not Found
1.316 Ign:10 http://deb.debian.org/debian stretch/main all Packages
1.357 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
1.397 Err:12 http://deb.debian.org/debian stretch-updates/main amd64 Packages
1.397   404  Not Found
1.401 Reading package lists...
1.407 W: The repository 'http://security.debian.org/debian-security stretch/updates Release' does not have a Release file.
1.407 W: The repository 'http://deb.debian.org/debian stretch Release' does not have a Release file.
1.407 W: The repository 'http://deb.debian.org/debian stretch-updates Release' does not have a Release file.
1.407 E: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/main/binary-amd64/Packages  404  Not Found [IP: 151.101.2.132 80]
1.407 E: Failed to fetch http://deb.debian.org/debian/dists/stretch/main/binary-amd64/Packages  404  Not Found
1.407 E: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/main/binary-amd64/Packages  404  Not Found
1.407 E: Some index files failed to download. They have been ignored, or old ones used instead.
------
Dockerfile:3
--------------------
   1 |     FROM node:16.15.1-stretch-slim
   2 |
   3 | >>> RUN apt-get update && apt-get -y upgrade
   4 |
   5 |     RUN apt-get install -y git curl
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get update && apt-get -y upgrade" did not complete successfully: exit code: 100
```

I have fixed both issues and tested building the image and running the container to build the docs site locally.

Reviewed-on: https://codeberg.org/Codeberg/Documentation/pulls/630
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Javier Pérez <walpo@noreply.codeberg.org>
Co-committed-by: Javier Pérez <walpo@noreply.codeberg.org>
2025-11-21 21:40:44 +01:00

4.6 KiB

Codeberg Documentation

This repository contains the documentation for Codeberg, with some code to build it into a static website.

Please have a look into it and consider to help writing the Documentation. This is still very much work-in-progress, the more useful material we collect, the better we can later present it! All contributions are very welcome!

For an introduction on contributing to Codeberg Documentation, please have a look at the section on improving the documentation.

Usage

Local Development using nodejs

If you want to work on the documentation, for example by writing your own articles, the easiest way to do so is to fork the documentation repository and develop locally.

To learn how to get pnpm see the PNpm website.

First, run

pnpm install

to install all dependencies (they will be installed only for this project, not globally). You only have to do this once.

Then run

pnpm run dev

to start a development web server that by default is listening at http://localhost:8080.

Now you can simply change, add or remove files, save them and the development server should automatically reload all changed pages using the amazing Browsersync.

When you're done, commit your changes to your fork and write a pull request for Codeberg/Documentation. We're happy about every contribution!

Local development using the Dockerfile

If you do not have nodejs installed or do not want to run the development web server directly on your host, you can also use a docker container.

You must have a container-engine installed (docker, podman, etc.)

First build the container image:

docker build --tag codeberg-docs:dev .

You do not have to rebuild the image every time. Once you build the image you can always start the development webserver using the container engine:

docker run --name "codeberg-docs" --rm --tty --interactive --volume "${PWD}:/docs" --publish "127.0.0.1:8080:8080/tcp" codeberg-docs:dev

Use the "External" URL the container outputs on startup to access your documentation.

Changes to files in the documentation are reflected in the browser as the server regularly updates the generated files.

Use Ctrl-C to exit / end the container.

The parameters are:

--rm removes the container after it's use --volume mounts the current (documentation repository root) folder to /docs in the container.

codeberg-docs:dev refers to the container image built in the first step (using docker build).

Build & Deployment

Like for local development, before building and deploying you first have to install the dependencies (once):

pnpm install

To build the entire website to the _site directory run

pnpm run build

Instead, to directly publish the page to Codeberg pages, you can also run

pnpm run deploy

which includes a call to pnpm run build.

Check and fix formatting errors

Before you create a pull request with your changes, you should check and fix formatting errors. Use the following command to fix formatting errors automatically:

pnpx prettier . -w

With the following command you can check if there are any formatting errors remaining:

pnpx prettier . -c

In addition you should also run the linter which is also used when checking pull requests:

pnpx cspell lint --no-progress --gitignore '{**,.*}/{*,.*}'

If this shows any errors, please fix them before committing your changes and creating a pull request.

Technical Information

This website uses Eleventy, a static site generator.

It's supplied as a dev-dependency in package.json and its dependencies are locked with package-lock.json to try to ensure reproducible builds.

It also uses PageFind, a static search library.

Deployment previews are generated for every PR using Surge.sh through the corresponding Woodpecker plugin.

A spellchecker is used to check for spelling errors in the documentation. To add exceptions to the spellchecker, add them to the .cspell.json file.

This project is deployed to Codeberg via a cron job executed on the Codeberg infrastructure.

License and Contributors

This website (excluding bundled fonts) is licensed under CC BY-SA 4.0. See the LICENSE file for details.

Please refer to the commit log for an exhaustive list of contributors to Codeberg Documentation.