1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00
pgbackrest/test/Dockerfile
David Steele ce0ea2cfab Use uncrustify for code formatting.
The code is not completely reflowed yet so there are some cases that uncrustify will not catch. The formatting will be improved over time.

Some block of code require special formatting so have been surrounded with the {uncrustify-off}/{uncrustify-on} markers. These exceptions should be kept to a minimum.

Add --code-format (to reformat code) and --code-format-check (to check formatting) to test.pl.

Add a CI test that will check code formatting. Code must be correctly formatted before it can be merge to integration.

Add documentation to the coding standards for code formatting.
2023-01-30 12:22:41 +07:00

39 lines
1.7 KiB
Docker

# export PGB=pgbackrest;export PGB_IMAGE=$PGB/test:u22-main;PGB_REPO=~/Documents/Code/$PGB
# docker build --squash -f $PGB_REPO/test/Dockerfile -t $PGB_IMAGE .
# docker run --privileged -itd --name $PGB-test -h $PGB-test -v $PGB_REPO:/home/vagrant/$PGB $PGB_IMAGE
#
# When running test.pl --code-format permissions may get munged. Run this from the pgbackrest/test path to fix them:
# find .. | grep "\.[ch]$" | xargs xattr -rc && find .. | grep "\.[ch]$" | xargs chmod -x
FROM ubuntu:jammy
# Install packages
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
sudo vim htop jq rsync sysstat curl \
libdbd-pg-perl libxml-checker-perl libyaml-perl \
devscripts build-essential lintian git cloc txt2man debhelper libssl-dev zlib1g-dev libperl-dev libxml2-dev liblz4-dev \
liblz4-tool libpq-dev lcov autoconf-archive zstd libzstd-dev bzip2 libbz2-dev pkg-config libyaml-dev libc6-dbg wget meson \
ccache valgrind tzdata uncrustify
# Install Docker
RUN groupadd -g5000 docker
RUN curl -fsSL https://get.docker.com | sh
# Create vagrant user
RUN adduser --ingroup=docker -uid=5000 --disabled-password --gecos \"\" vagrant
# Mark git path as safe
RUN sudo -u vagrant git config --global --add safe.directory /home/vagrant/pgbackrest
# Configure sudo
RUN echo '%docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# Mount tmpfs at /home/vagrant/test for faster testing
RUN sudo -u vagrant mkdir -m 770 /home/vagrant/test
RUN echo 'tmpfs /home/vagrant/test tmpfs size=4096M 0 1' >> /etc/fstab
USER vagrant
WORKDIR /home/vagrant
ENTRYPOINT sudo rm -f /var/run/docker.pid && sudo mount -a && sudo dockerd