Commit c801775e authored by Laurent Wouters's avatar Laurent Wouters
Browse files

[fix] Fixed issue #12 Docker image for reproductible builds

parent cc01f4308058
FROM buildpack-deps:18.04-curl
LABEL maintainer="Laurent Wouters <lwouters@cenotelie.fr>" vendor="Logilab SA" description="Build environment for the CubicWeb Linked Data Browser"
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get update && apt-get dist-upgrade -y && apt-get install -y --no-install-recommends \
build-essential mercurial nodejs
RUN mkdir /npm
RUN chmod -R a+rwX /npm
\ No newline at end of file
## Release Engineering ##
This folder contains the definition of the build environment for this project as a Docker image.
* `build-env.sh`: Script to build the Docker image that contains the build environment
* `build-src.sh`: Script to build the application sources. It is meant to be called from within the build environment.
#!/bin/sh
# Build the build environment as a Docker image
SCRIPT="$(readlink -f "$0")"
RELENG="$(dirname "$SCRIPT")"
ROOT="$(dirname "$RELENG")"
VERSION=$(hg -R "$ROOT" id -n)
HASH=$(hg -R "$ROOT" --debug id -i)
# Build the new image
docker build --tag "logilab/ld-build-env:$VERSION" --rm --label version="$VERSION" --label changeset="$HASH" "$RELENG"
docker tag "logilab/ld-build-env:$VERSION" "logilab/ld-build-env:latest"
#!/bin/sh
# Build the sources
SCRIPT="$(readlink -f "$0")"
RELENG="$(dirname "$SCRIPT")"
ROOT="$(dirname "$RELENG")"
VERSION=$(hg -R "$ROOT" id -n)
HASH=$(hg -R "$ROOT" --debug id -i)
echo ""
echo "=========================================="
echo "= Building @logilab/libview"
echo "=========================================="
(cd "$ROOT/libview"; rm -rf build)
(cd "$ROOT/libview"; npm install)
(cd "$ROOT/libview"; npm run build)
echo ""
echo "=========================================="
echo "= Building @logilab/views-logilab"
echo "=========================================="
(cd "$ROOT/views-logilab"; rm -rf build)
(cd "$ROOT/views-logilab"; rm -rf node_modules/@logilab/libview)
(cd "$ROOT/views-logilab"; npm install)
(cd "$ROOT/views-logilab"; npm run build)
echo ""
echo "=========================================="
echo "= Building @logilab/ld-browser"
echo "=========================================="
(cd "$ROOT/extension"; rm -rf build)
(cd "$ROOT/extension"; rm -rf node_modules/@logilab/libview)
(cd "$ROOT/extension"; npm install)
(cd "$ROOT/extension"; npm run build)
......@@ -26,6 +26,21 @@ A view itself is defined by two artifacts: a descriptor (JSON object) and an imp
For the browser to detect and use the view, a corresponding source has to be added in the browser's configuration, pointing to the location of the descriptor.
The descriptor then points to the location of the Javascript file containing the implementation that can be dynamically loaded by the browser.
## How to build
This project uses a build environment defined as a Docker image (you will need Docker to build).
Optionnaly, to re-create the build environment, execute:
```sh
./.releng/build-env.sh
```
To build the project, simply run:
```sh
./build.sh
```
## How to use
The first step is to build all the artifacts in this repository:
......
......@@ -6,31 +6,11 @@ ROOT="$(dirname "$SCRIPT")"
VERSION=$(hg -R "$ROOT" id -n)
HASH=$(hg -R "$ROOT" --debug id -i)
echo ""
echo "=========================================="
echo "= Building @logilab/libview"
echo "=========================================="
(cd "$ROOT/libview"; rm -rf build)
(cd "$ROOT/libview"; npm install)
(cd "$ROOT/libview"; npm run build)
# Cleanup
hg -R "$ROOT" purge --all
echo ""
echo "=========================================="
echo "= Building @logilab/views-logilab"
echo "=========================================="
(cd "$ROOT/views-logilab"; rm -rf build)
(cd "$ROOT/views-logilab"; rm -rf node_modules/@logilab/libview)
(cd "$ROOT/views-logilab"; npm install)
(cd "$ROOT/views-logilab"; npm run build)
echo ""
echo "=========================================="
echo "= Building @logilab/ld-browser"
echo "=========================================="
(cd "$ROOT/extension"; rm -rf build)
(cd "$ROOT/extension"; rm -rf node_modules/@logilab/libview)
(cd "$ROOT/extension"; npm install)
(cd "$ROOT/extension"; npm run build)
# Execute the build
docker run -it --rm --user=$(id -u) --group-add=$(id -g) -v "$ROOT:/src" -e "HOME=/npm" "logilab/ld-build-env:latest" /src/.releng/build-src.sh
# Build the new image
docker build --tag "logilab/ld-demo-views:$VERSION" --rm --label version="$VERSION" --label changeset="$HASH" "$ROOT/views-logilab"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment