I have a pipeline where I need to run a handful of different tests. One of those tests is to build a NextJS site with a Drupal CMS as the backend. This repository serves as a starting point for future projects so there is no other environment that this gets tested in (IE no production).
To build the NextJS site, the Drupal site needs to be running and available at port 443.
I was getting errors when building around connecting to the Drupal site. To test the connection to the apache server I have my pipeline set up like this right now:
pipelines:
pull-requests:
'**':
- step:
name: Test municipal profile
image: {custom image}
caches:
- composer
- node
script:
- curl https://127.0.0.1
That results in this error:
<span>curl: (7) Failed to connect to 127.0.0.1 port 443 after 0 ms: Connection refused</span>
Here is the custom image:
FROM ubuntu:22.04
ENV LC_ALL=C.UTF-8
CMD /bin/bash
# Ensure bash over sh.
RUN rm /bin/sh && \
ln -s /bin/bash /bin/sh;
ARG DEBIAN_FRONTEND=noninteractive
# Replace shell with bash so we can source files and install packages.
RUN apt-get update && \
apt-get -yq upgrade; \
apt-get install -yq software-properties-common && \
add-apt-repository -y ppa:ondrej/php && \
apt-get dist-upgrade -yq && \
apt-get update --fix-missing;
# Install basic packages
RUN apt-get -yq install --fix-missing \
apache2 \
apache2-utils \
apt-transport-https \
autoconf \
automake \
build-essential \
bzip2 \
ca-certificates \
curl \
file \
gcc \
g++ \
git \
imagemagick \
libfontconfig \
libfreetype6 \
libssl-dev \
jq \
make \
mysql-client \
patch \
python3-pip \
python3-venv \
unzip;
# Install PHP 8.2
RUN apt-get -yq install \
libapache2-mod-php8.2 \
php8.2 \
php8.2-bcmath \
php8.2-cli \
php8.2-curl \
php8.2-dom \
php8.2-gd \
php8.2-intl \
php8.2-imagick \
php8.2-mbstring \
php8.2-memcache \
php8.2-mysql \
php8.2-simplexml \
php8.2-soap \
php8.2-xml \
php8.2-xmlwriter \
php8.2-zip \
php-imagick \
php-json \
php-memcache \
php-pear;
RUN update-alternatives --set php /usr/bin/php8.2;
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --filename=composer --install-dir=/usr/bin;
RUN composer --verbose self-update --stable;
# Install NodeJS
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs && \
npm install -g npm && \
npm install -g yarn
# Install AWS cli
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install -i /usr/local/aws-cli -b /usr/local/bin;
# Clean up installs
RUN apt-get autoremove -yq && \
apt-get clean -yq && \
rm -rf /root/.composer /tmp/* ./awscli-bundle;
EXPOSE 80 443 3000
ENTRYPOINT ["apache2ctl"]
CMD ["-D", "FOREGROUND"]