gitlabci: Update Dockerfile and script

Re-heating a server template is a bad idea in the case of Docker images
since they are composed of immutable layers. The size of the image will
keep going up with each subsequent build. Building using debian:testing
instead.

GitLab is no longer allowing docker login with the main password. A
personal access token with the permissions of "api, read_registry,
write_registry" should be used instead.

Avoided copying the massive .container directory into the Docker
container by using a .dockerignore file.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati 2020-11-07 00:41:41 +05:30 committed by James Valleroy
parent 50fb166f54
commit a5c8c90eb0
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 28 additions and 13 deletions

View File

@ -1,22 +1,28 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
# This is an IaC pattern called "reheating a server template".
# This is very fast but can accumulate cruft over time.
# Use debian:testing if you want to build a fresh image.
FROM registry.salsa.debian.org/freedombox-team/freedombox:gitlabci
FROM debian:testing
USER root
COPY . /plinth
WORKDIR /plinth
RUN echo "deb http://deb.debian.org/debian testing main" > /etc/apt/sources.list
RUN echo "deb-src http://deb.debian.org/debian testing main" >> /etc/apt/sources.list
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get build-dep -y . # Dependencies of the freedombox Debian package
RUN apt-get install -y build-essential # Build dependencies
RUN apt-get install -y sshpass parted # Test dependencies
RUN apt-get install -y sudo
RUN apt-get install -y $(./run --list-dependencies) # Module dependencies
# Dependencies of the freedombox Debian package
RUN apt-get build-dep -y .
# Build dependencies
RUN apt-get install -y build-essential \
# Test dependencies
sshpass parted \
sudo python3-pip
# Module dependencies
RUN apt-get install -y $(./run --list-dependencies)
# Coverage should know that test_functional.py files are tests
RUN pip3 install splinter pytest-bdd

View File

@ -0,0 +1,10 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
**/.git
**/.container
**/.vagrant
**/.ci
**/functional_tests
**/doc
**/build
**/static

View File

@ -1,9 +1,8 @@
#! /bin/bash
# SPDX-License-Identifier: AGPL-3.0-or-later
# Provide your Salsa credentials here
docker login registry.salsa.debian.org
# This might need 20 minutes to run
docker build -t registry.salsa.debian.org/freedombox-team/freedombox:gitlabci -f .ci/Dockerfile.gitlabci .
# Build and upload a new image to the container registry
DOCKER_BUILDKIT=1 docker build -t registry.salsa.debian.org/freedombox-team/freedombox:gitlabci -f .ci/Dockerfile.gitlabci .
docker push registry.salsa.debian.org/freedombox-team/freedombox:gitlabci