Commit ec5b244a authored by ale's avatar ale

Simplify the build process

A few substantial changes:

* use a multi-stage Dockerfile, instead of a gitlab-CI setup with
  a dedicated build stage (makes the build more easily reproducible)
* ensures permissions are set correctly in the resulting image
parent 761afa88
Pipeline #4142 passed with stages
in 4 minutes and 46 seconds
image: docker:latest
stages:
- build
- docker_build
- release
......@@ -13,25 +12,12 @@ variables:
RELEASE_TAG: $CI_REGISTRY_IMAGE:latest
GIT_SUBMODULE_STRATEGY: recursive
build:
stage: build
image: "debian:stretch"
script:
- apt-get -q update
- env DEBIAN_FRONTEND=noninteractive apt-get -qy install curl make patch rsync default-jre-headless wget unzip
- make
artifacts:
paths:
- build/
docker_build:
stage: docker_build
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.git.autistici.org
- docker build --build-arg ci_token=$CI_JOB_TOKEN --pull -t $IMAGE_TAG .
- docker push $IMAGE_TAG
dependencies:
- build
release:
stage: release
......
FROM debian:stable AS build
ENV RC_VERSION=1.3.9
ADD . /build
RUN apt-get -q update && env DEBIAN_FRONTEND=noninteractive apt-get -qy install --no-install-recommends bash curl make patch rsync default-jre-headless wget unzip
RUN /build/install-roundcube --version=${RC_VERSION} --destdir=/build/src build && echo ${RC_VERSION} > /build/src/.rc_version
FROM registry.git.autistici.org/ai3/docker/apache2-php-base:master
COPY conf /tmp/conf
COPY build/src /var/www/webmail
COPY build.sh /tmp/build.sh
COPY start.sh /start.sh
#COPY install-roundcube /tmp/install-roundcube
COPY --from=build /build/src /var/www/webmail
RUN /tmp/build.sh && rm -fr /tmp/build.sh /tmp/conf
ENTRYPOINT ["/usr/local/bin/chaperone"]
......@@ -45,10 +45,12 @@ if [ "x$(which install_packages)" = "x" ]; then
fi
set -e
umask 022
install_packages ${BUILD_PACKAGES} ${PACKAGES}
# Install the configuration, overlayed over /etc.
chmod -R o-w /tmp/conf
rsync -a /tmp/conf/ /etc/
# Setup Apache.
......
apache2_setup.service: {
roundcube_setup.service: {
type: oneshot,
stdout: inherit,
service_groups: INIT,
......
......@@ -12,6 +12,8 @@
set -e
set -u
umask 022
# External plugins to install.
EXTERNAL_PLUGINS=(
sauserprefs="https://github.com/JohnDoh/Roundcube-Plugin-SpamAssassin-User-Prefs-SQL/archive/1.17.1.tar.gz"
......@@ -31,6 +33,7 @@ download_roundcube_source() {
curl -Ls "${rc_dist_url}" \
| tar -x -z --strip-components=1 \
--exclude="*/installer/*" \
--no-same-owner --no-same-permissions \
-C ${target} -f -
}
......
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