mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Docker: Centralize repo dependencies
Now, we have `docker/scripts/install-deps.sh`, a script used by both Docker and .gitlab-ci.yml. We can now focus on changing deps in this script along as well as documentation going forward. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
6c7bb04b93
commit
f4406ccf5c
3 changed files with 52 additions and 51 deletions
|
@ -1,4 +1,4 @@
|
|||
image: archlinux
|
||||
image: archlinux:base-devel
|
||||
|
||||
cache:
|
||||
key: system-v1
|
||||
|
@ -7,45 +7,28 @@ cache:
|
|||
- .pkg-cache
|
||||
|
||||
variables:
|
||||
AUR_CONFIG: conf/config
|
||||
AUR_CONFIG: conf/config # Default MySQL config setup in before_script.
|
||||
DB_HOST: localhost
|
||||
|
||||
before_script:
|
||||
- pacman -Syu --noconfirm --noprogressbar --needed --cachedir .pkg-cache
|
||||
base-devel git gpgme protobuf pyalpm python-mysqlclient
|
||||
python-pygit2 python-srcinfo python-bleach python-markdown
|
||||
python-sqlalchemy python-alembic python-pytest python-werkzeug
|
||||
python-pytest-tap python-fastapi hypercorn nginx python-authlib
|
||||
python-itsdangerous python-httpx python-jinja python-pytest-cov
|
||||
python-requests python-aiofiles python-python-multipart
|
||||
python-pytest-asyncio python-coverage python-bcrypt
|
||||
python-email-validator openssh python-lxml mariadb
|
||||
python-isort flake8
|
||||
- bash -c "echo '127.0.0.1 localhost' > /etc/hosts"
|
||||
- bash -c "echo '::1 localhost' >> /etc/hosts"
|
||||
- mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
|
||||
- ./docker/scripts/install-deps.sh
|
||||
- useradd -U -d /aurweb -c 'AUR User' aur
|
||||
- ./docker/mariadb-entrypoint.sh
|
||||
- (cd '/usr' && /usr/bin/mysqld_safe --datadir='/var/lib/mysql') &
|
||||
- 'until : > /dev/tcp/127.0.0.1/3306; do sleep 1s; done'
|
||||
- mysql -u root -e "CREATE USER 'aur'@'localhost' IDENTIFIED BY 'aur';"
|
||||
- mysql -u root -e "CREATE DATABASE aurweb_test;"
|
||||
- mysql -u root -e "GRANT ALL ON aurweb_test.* TO 'aur'@'localhost';"
|
||||
- mysql -u root -e "FLUSH PRIVILEGES;"
|
||||
- sed -r "s;YOUR_AUR_ROOT;$(pwd);g" conf/config.dev > conf/config
|
||||
- cp conf/config conf/config.sqlite
|
||||
- cp conf/config.defaults conf/config.sqlite.defaults
|
||||
- sed -i -r 's;backend = .*;backend = sqlite;' conf/config.sqlite
|
||||
- sed -i -r "s;name = .*;name = $(pwd)/aurweb.sqlite3;" conf/config.sqlite
|
||||
- ./docker/test-mysql-entrypoint.sh # Create mysql AUR_CONFIG.
|
||||
- ./docker/test-sqlite-entrypoint.sh # Create sqlite AUR_CONFIG.
|
||||
- make -C po all install
|
||||
- python setup.py install --install-scripts=/usr/local/bin
|
||||
- python -m aurweb.initdb # Initialize MySQL tables.
|
||||
- AUR_CONFIG=conf/config.sqlite python -m aurweb.initdb
|
||||
- make -C test clean
|
||||
|
||||
test:
|
||||
script:
|
||||
- python setup.py install
|
||||
- make -C po all install
|
||||
- python -m aurweb.initdb
|
||||
- make -C test sh # sharness tests use sqlite.
|
||||
- make -C test pytest # pytest with mysql.
|
||||
- AUR_CONFIG=conf/config.sqlite make -C test pytest # pytest with sqlite.
|
||||
- coverage report --include='aurweb/*'
|
||||
- coverage xml --include='aurweb/*'
|
||||
- make -C test sh pytest # sharness tests use sqlite & pytest w/ mysql.
|
||||
- AUR_CONFIG=conf/config.sqlite make -C test pytest
|
||||
- make -C test coverage # Produce coverage reports.
|
||||
- flake8 --count aurweb # Assert no flake8 violations in aurweb.
|
||||
- flake8 --count test # Assert no flake8 violations in test.
|
||||
- flake8 --count migrations # Assert no flake8 violations in migrations.
|
||||
|
|
37
Dockerfile
37
Dockerfile
|
@ -1,31 +1,30 @@
|
|||
FROM archlinux:base-devel
|
||||
|
||||
ENV PYTHONPATH=/aurweb
|
||||
ENV AUR_CONFIG=conf/config
|
||||
|
||||
# Copy our single bootstrap script.
|
||||
COPY docker/scripts/install-deps.sh /install-deps.sh
|
||||
RUN /install-deps.sh
|
||||
|
||||
# Add our aur user.
|
||||
RUN useradd -U -d /aurweb -c 'AUR User' aur
|
||||
|
||||
# Setup some default system stuff.
|
||||
RUN ln -sf /usr/share/zoneinfo/UTC /etc/localtime
|
||||
|
||||
RUN mkdir -p .pkg-cache
|
||||
# Copy the rest of docker.
|
||||
COPY ./docker /docker
|
||||
COPY ./docker/scripts/*.sh /usr/local/bin/
|
||||
|
||||
# Install dependencies.
|
||||
RUN pacman -Syu --noconfirm --noprogressbar \
|
||||
--cachedir .pkg-cache git gpgme protobuf pyalpm \
|
||||
python-mysqlclient python-pygit2 python-srcinfo python-bleach \
|
||||
python-markdown python-sqlalchemy python-alembic python-pytest \
|
||||
python-werkzeug python-pytest-tap python-fastapi nginx python-authlib \
|
||||
python-itsdangerous python-httpx python-jinja python-pytest-cov \
|
||||
python-requests python-aiofiles python-python-multipart \
|
||||
python-pytest-asyncio python-coverage hypercorn python-bcrypt \
|
||||
python-email-validator openssh python-lxml mariadb mariadb-libs \
|
||||
python-isort flake8 cgit uwsgi uwsgi-plugin-cgi php php-fpm \
|
||||
python-asgiref uvicorn
|
||||
|
||||
RUN useradd -U -d /aurweb -c 'AUR User' aur
|
||||
|
||||
COPY docker /docker
|
||||
# Copy from host to container.
|
||||
COPY . /aurweb
|
||||
|
||||
# Working directory is aurweb root @ /aurweb.
|
||||
WORKDIR /aurweb
|
||||
COPY . .
|
||||
|
||||
# Install translations.
|
||||
RUN make -C po all install
|
||||
RUN python3 setup.py install --install-scripts=/usr/local/bin
|
||||
|
||||
# Install package and scripts.
|
||||
RUN python setup.py install --install-scripts=/usr/local/bin
|
||||
|
|
19
docker/scripts/install-deps.sh
Executable file
19
docker/scripts/install-deps.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
# Install Arch Linux dependencies. This is centralized here
|
||||
# for CI and Docker usage and should always reflect the most
|
||||
# robust development ecosystem.
|
||||
set -eou pipefail
|
||||
|
||||
pacman -Syu --noconfirm --noprogressbar \
|
||||
--cachedir .pkg-cache git gpgme protobuf pyalpm \
|
||||
python-mysqlclient python-pygit2 python-srcinfo python-bleach \
|
||||
python-markdown python-sqlalchemy python-alembic python-pytest \
|
||||
python-werkzeug python-pytest-tap python-fastapi nginx python-authlib \
|
||||
python-itsdangerous python-httpx python-jinja python-pytest-cov \
|
||||
python-requests python-aiofiles python-python-multipart \
|
||||
python-pytest-asyncio python-coverage hypercorn python-bcrypt \
|
||||
python-email-validator openssh python-lxml mariadb mariadb-libs \
|
||||
python-isort flake8 cgit uwsgi uwsgi-plugin-cgi php php-fpm \
|
||||
python-asgiref uvicorn
|
||||
|
||||
exec "$@"
|
Loading…
Add table
Reference in a new issue