Skip to content

Commit d806a01

Browse files
justafishdawehner
authored andcommitted
Removes using containers for the node packages (#701)
* Removes using containers for the node packages * Upgrade Docker in CircleCI * Revert previous commit * Ensure the docker file actually runs * Set the right env variable by default * install yarn * fix syntax * install more recent node version * Try to use nvm before make * shrug * Fix test commands for node * try to always use the right node version * let's try * remove invalid command * try to install nvm * Maybe update node * Add missing line * . * . * Remove unused script
1 parent bcaa204 commit d806a01

23 files changed

Lines changed: 184 additions & 356 deletions

File tree

.circleci/config.yml

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,36 @@ aliases:
44
- &yarn-cache
55
v4-yarn-cache
66

7-
- &composer-cache
8-
v4-composer-cache
9-
107
commands:
11-
12-
start-project:
8+
setup-project:
139
steps:
1410
- checkout
1511
- restore_cache:
1612
keys:
1713
- *yarn-cache
18-
- restore_cache:
19-
keys:
20-
- *composer-cache
14+
- run:
15+
name: Install Node 10 and Yarn
16+
command: |
17+
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
18+
export NVM_DIR="/opt/circleci/.nvm"
19+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
20+
nvm install v10
21+
nvm alias default v10
22+
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
23+
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
24+
sudo apt-get update && sudo apt-get install yarn
25+
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
26+
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
2127
- run:
2228
name: Start Docker
2329
command: |
2430
set -x
25-
uid=$(id -u) gid=$(id -g) docker-compose build
31+
make build
2632
docker-compose up -d
27-
./.docker/check-ready.sh
28-
- save_cache:
29-
key: *composer-cache
30-
paths:
31-
- ~/.composer/cache
33+
sleep 15
34+
- run:
35+
name: Install Projects
36+
command: make install
3237
- save_cache:
3338
key: *yarn-cache
3439
paths:
@@ -82,13 +87,13 @@ jobs:
8287
test_node:
8388
machine: true
8489
steps:
85-
- start-project
90+
- setup-project
8691
- run:
8792
name: Run tests
8893
command: |
8994
docker exec -it drupal_admin_ui_drupal drush user:password admin admin
90-
docker exec -it -e REACT_APP_DRUPAL_BASE_URL=http://drupal drupal_admin_ui_node yarn workspace admin-ui build
91-
docker exec -it -e REACT_APP_DRUPAL_BASE_URL=http://drupal -e NIGHTWATCH_LOGIN_admin_PASSWORD=admin drupal_admin_ui_node yarn test
95+
yarn build
96+
REACT_APP_DRUPAL_BASE_URL=http://drupal NIGHTWATCH_LOGIN_admin_PASSWORD=admin yarn test
9297
- store_test_results:
9398
path: ~/project/packages/admin-ui/reports
9499
- store_artifacts:
@@ -97,7 +102,7 @@ jobs:
97102
test_drupal:
98103
machine: true
99104
steps:
100-
- start-project
105+
- setup-project
101106
- run:
102107
name: Run tests
103108
command: docker exec -it drupal_admin_ui_drupal composer test
@@ -107,7 +112,7 @@ jobs:
107112
dist:
108113
machine: true
109114
steps:
110-
- start-project
115+
- setup-project
111116

112117
# This pushes to https://github.com/jsdrupal/drupal-admin-ui-dist
113118
# which is then distributed to https://packagist.org/packages/justafish/drupal-admin-ui

.docker/check-ready.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

.docker/drupal/Dockerfile

Lines changed: 0 additions & 48 deletions
This file was deleted.

.docker/images/drupal/Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FROM alpine:3.8 AS dependencies
2+
3+
ARG HOST_UID
4+
ARG HOST_GID
5+
6+
ADD .docker/scripts/createUser.sh /root/createUser.sh
7+
8+
RUN apk add shadow sudo supervisor make \
9+
php sqlite composer git \
10+
php7-pdo php7-gd php7-openssl php7-json php7-mbstring php7-dom php7-session php7-xml php7-simplexml \
11+
php7-tokenizer php7-curl php7-xmlwriter php7-ctype php7-opcache php7-pdo_mysql mysql-client php7-fpm \
12+
php7-xdebug && \
13+
sed -i 's/^CREATE_MAIL_SPOOL=yes/CREATE_MAIL_SPOOL=no/' /etc/default/useradd && \
14+
sed -e 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/g' -i /etc/sudoers && \
15+
sed -i 's/\[supervisord\]/\[supervisord\]\nuser=root ;/' /etc/supervisord.conf && \
16+
sed -i 's/;opcache.enable=1/opcache.enable=1/' /etc/php7/php.ini && \
17+
sed -i 's/user = nobody/user = nginx/' /etc/php7/php-fpm.d/www.conf && \
18+
sed -i 's/group = nobody/group = nginx/' /etc/php7/php-fpm.d/www.conf && \
19+
sed -i 's/listen = 127.0.0.1:9000/listen = \/var\/run\/nginx\/php-fpm7.sock/' /etc/php7/php-fpm.d/www.conf && \
20+
sed -i 's/;listen.allowed_clients = 127.0.0.1/listen.allowed_clients = 127.0.0.1/' /etc/php7/php-fpm.d/www.conf && \
21+
sed -i 's/;listen.owner = nobody/listen.owner = nginx/' /etc/php7/php-fpm.d/www.conf && \
22+
sed -i 's/;listen.group = nginx/listen.group = nginx/' /etc/php7/php-fpm.d/www.conf && \
23+
sed -i 's/;listen.mode = 0660/listen.mode = 0660/' /etc/php7/php-fpm.d/www.conf && \
24+
NAME="nginx" HOST_UID=$HOST_UID HOST_GID=$HOST_GID /bin/sh /root/createUser.sh && rm /root/createUser.sh && \
25+
apk add nginx && \
26+
mkdir -p /run/nginx && \
27+
mkdir -p /var/www/.composer && \
28+
mkdir -p /var/www/.cache && \
29+
touch /var/www/.drupal-container && \
30+
chown -R nginx:nginx /var/www
31+
32+
ADD .docker/images/drupal/nginx-default.conf /etc/nginx/conf.d/default.conf
33+
ADD .docker/images/drupal/supervisord.conf /etc/supervisor.d/default.ini
34+
35+
FROM dependencies AS install
36+
USER nginx
37+
WORKDIR /var/www/drupal
38+
ENV PATH="/var/www/drupal/vendor/bin:${PATH}"
39+
RUN composer global require hirak/prestissimo
40+
41+
FROM install AS start
42+
EXPOSE 80
43+
ENTRYPOINT ["sudo", "supervisord", "-c", "/etc/supervisord.conf"]

.docker/node/Dockerfile

Lines changed: 0 additions & 29 deletions
This file was deleted.

.docker/node/setup.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,8 @@ then
3030
groupmod -g ${NEW_GID} ${GROUPNAME}
3131
find / -group ${HOST_GID} -exec chgrp -h ${GROUPNAME} {} \;
3232
fi
33+
34+
# Adds a user and a corresponding group, and adds the user to sudoers.
35+
groupadd -g ${HOST_GID} ${NAME}
36+
useradd -u ${HOST_UID} -d /var/www -g ${HOST_GID} ${NAME}
37+
usermod -a -G wheel ${NAME}

.env.defaults

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Docker
2+
HOST_UID=
3+
HOST_GID=

0 commit comments

Comments
 (0)