From c4160c0f663655c03c5dafee4f65aea756e53a58 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sat, 12 Oct 2024 09:19:15 +0300 Subject: [PATCH 01/32] removed obsolete version from docker compose --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1a9e0c7c8..0fa6510b8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: "3.9" services: db: build: From 245f1c222aaced195987fb989aa21b2e782efdd4 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sat, 12 Oct 2024 09:27:34 +0300 Subject: [PATCH 02/32] switched restart policy of services to on-failure:3 --- docker-compose.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0fa6510b8..05916e6c4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,6 @@ services: db: + restart: on-failure:3 build: context: "." dockerfile: docker/Dockerfile.db @@ -19,7 +20,7 @@ services: uwsgi: - restart: always + restart: on-failure:3 build: context: "." dockerfile: docker/Dockerfile @@ -46,7 +47,7 @@ services: - db redis: - restart: always + restart: on-failure:3 image: redis:latest healthcheck: test: ["CMD", "redis-cli","ping"] From 5f8d2183cec6fedd0ababa917ef38a5d0cdf0a1c Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sat, 12 Oct 2024 09:47:35 +0300 Subject: [PATCH 03/32] removed zombie config from Dockerfile --- docker/Dockerfile | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 0fb89166a..15c7fb626 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,24 +1,22 @@ FROM ruby:3.0.0 -# docker build -f docker/Dockerfile -t qpixel_uwsgi . - ENV RUBYOPT="-KU -E utf-8:utf-8" RUN apt-get update && \ apt-get install -y gcc && \ apt-get install -y make && \ apt-get install -y \ - default-libmysqlclient-dev \ - autoconf \ - bison \ - build-essential \ - libssl-dev \ - libyaml-dev \ - libreadline-dev \ - zlib1g-dev \ - libncurses5-dev \ - libffi-dev \ - libgdbm-dev && \ - apt-get install -y default-mysql-server + default-libmysqlclient-dev \ + autoconf \ + bison \ + build-essential \ + libssl-dev \ + libyaml-dev \ + libreadline-dev \ + zlib1g-dev \ + libncurses5-dev \ + libffi-dev \ + libgdbm-dev && \ + apt-get install -y default-mysql-server # Install nodejs and imagemagick WORKDIR /opt From e5d8ab5482822d2c9dbc32b1356ae4a141e8cad9 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sat, 12 Oct 2024 09:49:19 +0300 Subject: [PATCH 04/32] there is no sleep command in Dockerfile --- docker/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker/README.md b/docker/README.md index edfec7c60..279d9ccff 100644 --- a/docker/README.md +++ b/docker/README.md @@ -70,8 +70,7 @@ Creating qpixel_db_1 ... done Creating qpixel_uwsgi_1 ... done ``` -The uwsgi container has a sleep command for 15 seconds to give the database a chance to start, -so don't expect to see output right away. After about 20 seconds, check to make sure the server is running (and verify port 3000, note that you can change this mapping in the `.env` file) +After about 20 seconds, check to make sure the server is running (and verify port 3000, note that you can change this mapping in the `.env` file) ``` qpixel_uwsgi_1 | => Booting Puma From 25029df8119a5088eca6cdf17b672370f6af9fee Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sat, 12 Oct 2024 09:50:58 +0300 Subject: [PATCH 05/32] removed unnecessary console output from instructions on how to start containers --- docker/README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docker/README.md b/docker/README.md index 279d9ccff..3fc662da6 100644 --- a/docker/README.md +++ b/docker/README.md @@ -61,13 +61,10 @@ NOTE: If you get an error like "Cannot connect to the Docker daemon at ...", you ## 4. Start Containers -Then start your containers! +Then start your containers: ```bash docker compose up # append -d if you want to detach the processes, although it can be useful to see output into the terminal -Creating qpixel_redis_1 ... done -Creating qpixel_db_1 ... done -Creating qpixel_uwsgi_1 ... done ``` After about 20 seconds, check to make sure the server is running (and verify port 3000, note that you can change this mapping in the `.env` file) From 3a4d1cb9829328d491b325b411fb496a8039b690 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sat, 12 Oct 2024 10:25:11 +0300 Subject: [PATCH 06/32] do not start Rails in dev mode immediately --- docker/entrypoint.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) mode change 100644 => 100755 docker/entrypoint.sh diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh old mode 100644 new mode 100755 index efbf2b14e..bfb93f605 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -15,5 +15,7 @@ fi # If this isn't done again, there is a 500 error on the first page about posts rails db:seed -# defaults to port 3000 -rails server -b 0.0.0.0 +# we don't start the server immediately in dev mode +if [[ -z "$1" ]]; then + rails server -b 0.0.0.0 +fi From 737c6ebb55a925969abb51ff2629569c3aa45b8e Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sat, 12 Oct 2024 10:25:36 +0300 Subject: [PATCH 07/32] added Dockerfile.dev for local development purposes --- docker/Dockerfile.dev | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 docker/Dockerfile.dev diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev new file mode 100644 index 000000000..af533f570 --- /dev/null +++ b/docker/Dockerfile.dev @@ -0,0 +1,43 @@ +FROM ruby:3.0.0 + +ENV RUBYOPT="-KU -E utf-8:utf-8" +RUN apt-get update && \ + apt-get install -y gcc && \ + apt-get install -y make && \ + apt-get install -y \ + default-libmysqlclient-dev \ + autoconf \ + bison \ + build-essential \ + libssl-dev \ + libyaml-dev \ + libreadline-dev \ + zlib1g-dev \ + libncurses5-dev \ + libffi-dev \ + libgdbm-dev && \ + apt-get install -y default-mysql-server + +# Install nodejs and imagemagick +WORKDIR /opt +RUN wget https://nodejs.org/dist/v12.18.3/node-v12.18.3-linux-x64.tar.xz && \ + tar xf node-v12.18.3-linux-x64.tar.xz && \ + wget https://imagemagick.org/archive/binaries/magick && \ + chmod +x magick && \ + mv magick /usr/local/bin/magick + +ENV NODEJS_HOME=/opt/node-v12.18.3-linux-x64/bin +ENV PATH=$NODEJS_HOME:$PATH + +# Add core code to container +WORKDIR /code +COPY . /code +RUN gem install bundler -v 2.4.22 && \ + bundle install + +EXPOSE 80 443 3000 + +RUN /code/docker/entrypoint.sh dev + +# ensures continued running of the container +CMD sleep 7d From d446686df45bd2ad276d217153099bb3dbfd0936 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sat, 12 Oct 2024 10:26:40 +0300 Subject: [PATCH 08/32] updated README for Docker setup to reflect that dev mode no longer autostarts Rails --- docker/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docker/README.md b/docker/README.md index 3fc662da6..61cb92282 100644 --- a/docker/README.md +++ b/docker/README.md @@ -67,6 +67,18 @@ Then start your containers: docker compose up # append -d if you want to detach the processes, although it can be useful to see output into the terminal ``` +After the containers have started, connect to the uwsgi container (if you are using Docker Desktop, you can connect directly from the application): + +```bash +docker exec -it qpixel-uwsgi-1 bash +``` + +And run the following command to start Rails (starting the server is intentionally disabled to allow for live debugging): + +```bash +rails server -b 0.0.0.0 +``` + After about 20 seconds, check to make sure the server is running (and verify port 3000, note that you can change this mapping in the `.env` file) ``` From 86da6b22964111e16b989270e67007362a9e59c8 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sat, 12 Oct 2024 10:43:09 +0300 Subject: [PATCH 09/32] made uwsgi Dockerfile configurable --- docker-compose.yml | 2 +- docker/compose-env | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 05916e6c4..f85b46d3b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,7 +23,7 @@ services: restart: on-failure:3 build: context: "." - dockerfile: docker/Dockerfile + dockerfile: ${CLIENT_DOKERFILE} depends_on: db: condition: service_healthy diff --git a/docker/compose-env b/docker/compose-env index 162e3169b..108c616d3 100644 --- a/docker/compose-env +++ b/docker/compose-env @@ -3,3 +3,4 @@ COMMUNITY_NAME=Dev Community RAILS_ENV=development CONFIRMABLE_ALLOWED_ACCESS_DAYS=2 ENV_FILE_LOCATION=./docker/env +CLIENT_DOKERFILE=docker/Dockerfile From 17d4095fdc3f5814630b3216f7d1b88eefee651f Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sat, 12 Oct 2024 10:54:50 +0300 Subject: [PATCH 10/32] documented usage of custom build configurations for Docker setup --- docker/README.md | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/docker/README.md b/docker/README.md index 61cb92282..1022c49d2 100644 --- a/docker/README.md +++ b/docker/README.md @@ -32,7 +32,14 @@ chmod +x docker/local-setup.sh docker/local-setup.sh ``` -Editing the `./.env` file will modify the corresponding variables used in the docker-compose.yml file but **NOT** the environment variables in the container. Editing the `./docker/env` file will change environment variables only in the running container. +Editing the `./.env` file will modify the corresponding variables used in the docker-compose.yml file but **NOT** the environment variables in the container. +Editing the `./docker/env` file will change environment variables only in the running container. + +### Custom build config + +Our Docker setup supports custom build configurations for the uwsgi contianer via the `CLIENT_DOKERFILE` environment variable (see [compose-env](/docker/compose-env)). The default is `docker/Dockerfile`, which points to a preconfigured [production-like setup](/docker/Dockerfile). For developers who need more control over their setup, we also provide a [configuration](/docker/Dockerfile.dev) that is tailored for local development. + +To use a custom build config, change the `CLIENT_DOCKERFILE` variable in the .env file that is automatically created by [local-setup.sh](/docker/local-setup.sh) in the project root. ## 2. Database File Ensure `config/database.yml` has the username and password as defined in [docker/env](docker/env) file. The `config/database.yml` should already be gitignored. @@ -64,19 +71,7 @@ NOTE: If you get an error like "Cannot connect to the Docker daemon at ...", you Then start your containers: ```bash -docker compose up # append -d if you want to detach the processes, although it can be useful to see output into the terminal -``` - -After the containers have started, connect to the uwsgi container (if you are using Docker Desktop, you can connect directly from the application): - -```bash -docker exec -it qpixel-uwsgi-1 bash -``` - -And run the following command to start Rails (starting the server is intentionally disabled to allow for live debugging): - -```bash -rails server -b 0.0.0.0 +docker compose up # append -d (--detach) if you want, although it can be useful to see output in the terminal ``` After about 20 seconds, check to make sure the server is running (and verify port 3000, note that you can change this mapping in the `.env` file) @@ -102,6 +97,22 @@ and see the interface. You can then click "Sign in" to login with what you defined for `$COMMUNITY_ADMIN_EMAIL` and `$COMMUNITY_ADMIN_PASSWORD`. Importantly, your password must be 6 characters or longer, otherwise the user won't be created. +### Custom build configs + +If you are using a custom build config that doesn't automatically start Rails or our [config for local development](/docker/Dockerfile.dev), you will also have to manually start the server. + +After the containers have started, connect to the uwsgi container (if you are using Docker Desktop, you can connect directly from the application): + +```bash +docker exec -it qpixel-uwsgi-1 bash +``` + +And run the following command to start Rails (starting the server is intentionally disabled to allow for live debugging): + +```bash +rails server -b 0.0.0.0 +``` + ## 5. Login Once you are logged in, you should see your icon in the top right: From 882d79ba5bbae3b6f3a2cb0ac7fc29d84fd15901 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sat, 12 Oct 2024 17:14:03 +0300 Subject: [PATCH 11/32] fixed typos in CLIENT_DOCKERFILE env variable --- docker-compose.yml | 2 +- docker/README.md | 2 +- docker/compose-env | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f85b46d3b..5333ed6d9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,7 +23,7 @@ services: restart: on-failure:3 build: context: "." - dockerfile: ${CLIENT_DOKERFILE} + dockerfile: ${CLIENT_DOCKERFILE} depends_on: db: condition: service_healthy diff --git a/docker/README.md b/docker/README.md index 1022c49d2..7a2f81886 100644 --- a/docker/README.md +++ b/docker/README.md @@ -37,7 +37,7 @@ Editing the `./docker/env` file will change environment variables only in the ru ### Custom build config -Our Docker setup supports custom build configurations for the uwsgi contianer via the `CLIENT_DOKERFILE` environment variable (see [compose-env](/docker/compose-env)). The default is `docker/Dockerfile`, which points to a preconfigured [production-like setup](/docker/Dockerfile). For developers who need more control over their setup, we also provide a [configuration](/docker/Dockerfile.dev) that is tailored for local development. +Our Docker setup supports custom build configurations for the uwsgi contianer via the `CLIENT_DOCKERFILE` environment variable (see [compose-env](/docker/compose-env)). The default is `docker/Dockerfile`, which points to a preconfigured [production-like setup](/docker/Dockerfile). For developers who need more control over their setup, we also provide a [configuration](/docker/Dockerfile.dev) that is tailored for local development. To use a custom build config, change the `CLIENT_DOCKERFILE` variable in the .env file that is automatically created by [local-setup.sh](/docker/local-setup.sh) in the project root. diff --git a/docker/compose-env b/docker/compose-env index 108c616d3..140d36f60 100644 --- a/docker/compose-env +++ b/docker/compose-env @@ -3,4 +3,4 @@ COMMUNITY_NAME=Dev Community RAILS_ENV=development CONFIRMABLE_ALLOWED_ACCESS_DAYS=2 ENV_FILE_LOCATION=./docker/env -CLIENT_DOKERFILE=docker/Dockerfile +CLIENT_DOCKERFILE=docker/Dockerfile From 00b4670450d60c6cd315ca2cee5c29b5710e4ff2 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sat, 12 Oct 2024 17:16:09 +0300 Subject: [PATCH 12/32] check for dev mode in entrypoint.sh should actually check against the mode --- docker/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index bfb93f605..b6fbc730e 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -16,6 +16,6 @@ fi rails db:seed # we don't start the server immediately in dev mode -if [[ -z "$1" ]]; then +if [[ "$1" != 'dev' ]]; then rails server -b 0.0.0.0 fi From c3455529b8f57ba6928b154cc124e41a7578ce80 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sun, 20 Oct 2024 19:51:50 +0300 Subject: [PATCH 13/32] added initial Dockerfile.amd --- docker/Dockerfile.amd | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 docker/Dockerfile.amd diff --git a/docker/Dockerfile.amd b/docker/Dockerfile.amd new file mode 100644 index 000000000..44ca178e7 --- /dev/null +++ b/docker/Dockerfile.amd @@ -0,0 +1,41 @@ +FROM --platform=linux/arm64 ruby:3.0.0 + +ENV RUBYOPT="-KU -E utf-8:utf-8" +RUN apt-get update && \ + apt-get install -y gcc && \ + apt-get install -y make && \ + apt-get install -y \ + default-libmysqlclient-dev \ + autoconf \ + bison \ + build-essential \ + libssl-dev \ + libyaml-dev \ + libreadline-dev \ + zlib1g-dev \ + libncurses5-dev \ + libffi-dev \ + libgdbm-dev && \ + apt-get install -y default-mysql-server + +# Install nodejs and imagemagick +WORKDIR /opt +RUN wget https://nodejs.org/dist/v12.18.3/node-v12.18.3-linux-x64.tar.xz && \ + tar xf node-v12.18.3-linux-x64.tar.xz && \ + wget https://imagemagick.org/archive/binaries/magick && \ + chmod +x magick && \ + mv magick /usr/local/bin/magick + +ENV NODEJS_HOME=/opt/node-v12.18.3-linux-x64/bin +ENV PATH=$NODEJS_HOME:$PATH + +# Add core code to container +WORKDIR /code +COPY . /code +RUN gem install bundler -v 2.4.22 && \ + bundle install + +EXPOSE 80 443 3000 +ENTRYPOINT ["/bin/bash"] +CMD ["/code/docker/entrypoint.sh"] + From 796d4e01cab5e216d13ad96f2e923aaa42166529 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sun, 20 Oct 2024 19:57:33 +0300 Subject: [PATCH 14/32] installing nokogiri on Mac requires force_ruby_platform --- docker/Dockerfile.amd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker/Dockerfile.amd b/docker/Dockerfile.amd index 44ca178e7..7b1bfaf15 100644 --- a/docker/Dockerfile.amd +++ b/docker/Dockerfile.amd @@ -32,6 +32,10 @@ ENV PATH=$NODEJS_HOME:$PATH # Add core code to container WORKDIR /code COPY . /code + +# see: https://nokogiri.org/tutorials/installing_nokogiri.html#how-can-i-avoid-using-a-precompiled-native-gem +RUN bundle config set force_ruby_platform true + RUN gem install bundler -v 2.4.22 && \ bundle install From 923914fbfc6bce44fd1505f0edb3b24c8c738b3b Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sun, 20 Oct 2024 20:04:59 +0300 Subject: [PATCH 15/32] added amd64-specific deps to Dockerfile.amd --- docker/Dockerfile.amd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docker/Dockerfile.amd b/docker/Dockerfile.amd index 7b1bfaf15..7927437bf 100644 --- a/docker/Dockerfile.amd +++ b/docker/Dockerfile.amd @@ -18,6 +18,12 @@ RUN apt-get update && \ libgdbm-dev && \ apt-get install -y default-mysql-server +# Install dependencies specific to amd64 +RUN dpkg --add-architecture amd64 +RUN apt update +RUN apt-get install libc6:amd64 +RUN apt-get install g++-multilib + # Install nodejs and imagemagick WORKDIR /opt RUN wget https://nodejs.org/dist/v12.18.3/node-v12.18.3-linux-x64.tar.xz && \ From 4fc84c527af1acf814734523e772170ad9bfa948 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Mon, 21 Oct 2024 13:20:31 +0300 Subject: [PATCH 16/32] fixed incorrect Dockerfile for arm64 naming --- docker/{Dockerfile.amd => Dockerfile.arm} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docker/{Dockerfile.amd => Dockerfile.arm} (100%) diff --git a/docker/Dockerfile.amd b/docker/Dockerfile.arm similarity index 100% rename from docker/Dockerfile.amd rename to docker/Dockerfile.arm From 1ddb25e62a42421b8a6118c87c5e72694915059a Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Tue, 22 Oct 2024 22:12:44 +0300 Subject: [PATCH 17/32] assume-yes flag must be set --- docker/Dockerfile.arm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index 7927437bf..6b3f4bd04 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -21,8 +21,8 @@ RUN apt-get update && \ # Install dependencies specific to amd64 RUN dpkg --add-architecture amd64 RUN apt update -RUN apt-get install libc6:amd64 -RUN apt-get install g++-multilib +RUN apt-get install -y libc6:amd64 +RUN apt-get install -y g++-multilib # Install nodejs and imagemagick WORKDIR /opt From 10ae42a3eab9e8346e5be5be9f08837178fc0595 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Tue, 22 Oct 2024 23:27:03 +0300 Subject: [PATCH 18/32] do not set force-ruby-platform globally --- docker/Dockerfile.arm | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index 6b3f4bd04..febae17b1 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -21,8 +21,7 @@ RUN apt-get update && \ # Install dependencies specific to amd64 RUN dpkg --add-architecture amd64 RUN apt update -RUN apt-get install -y libc6:amd64 -RUN apt-get install -y g++-multilib +RUN apt-get install -y libc6:amd64 g++-multilib liblzma-dev patch # Install nodejs and imagemagick WORKDIR /opt @@ -39,10 +38,8 @@ ENV PATH=$NODEJS_HOME:$PATH WORKDIR /code COPY . /code -# see: https://nokogiri.org/tutorials/installing_nokogiri.html#how-can-i-avoid-using-a-precompiled-native-gem -RUN bundle config set force_ruby_platform true - RUN gem install bundler -v 2.4.22 && \ + gem install nokogiri --platform=ruby && \ bundle install EXPOSE 80 443 3000 From 64fd35f28cdbe5f959f8fd1e8a4398b911e620ca Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Tue, 22 Oct 2024 23:49:05 +0300 Subject: [PATCH 19/32] removed patch from installed additional deps --- docker/Dockerfile.arm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index febae17b1..c0980bee2 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -21,7 +21,7 @@ RUN apt-get update && \ # Install dependencies specific to amd64 RUN dpkg --add-architecture amd64 RUN apt update -RUN apt-get install -y libc6:amd64 g++-multilib liblzma-dev patch +RUN apt-get install -y libc6:amd64 g++-multilib liblzma-dev # Install nodejs and imagemagick WORKDIR /opt From d146b6c98b8fba8704f46093edcaa2633b0fd7a0 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Tue, 22 Oct 2024 23:53:47 +0300 Subject: [PATCH 20/32] apparently, we need gcc-multilib & g++-multilib --- docker/Dockerfile.arm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index c0980bee2..958adda39 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -21,7 +21,12 @@ RUN apt-get update && \ # Install dependencies specific to amd64 RUN dpkg --add-architecture amd64 RUN apt update -RUN apt-get install -y libc6:amd64 g++-multilib liblzma-dev +RUN apt-get install -y libc6:amd64 +RUN apt-get install -y \ + gcc-multilib:amd64 \ + g++:amd64 \ + g++-multilib:amd64 \ + liblzma-dev # Install nodejs and imagemagick WORKDIR /opt From fb3daf3b2af2ddfafe609dc830b1569f0d95ceb5 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Wed, 23 Oct 2024 01:29:51 +0300 Subject: [PATCH 21/32] let's follow the official guidance on nokogiri on MacOS --- docker/Dockerfile.arm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index 958adda39..6acaac15a 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -24,9 +24,7 @@ RUN apt update RUN apt-get install -y libc6:amd64 RUN apt-get install -y \ gcc-multilib:amd64 \ - g++:amd64 \ - g++-multilib:amd64 \ - liblzma-dev + g++-multilib:amd64 # Install nodejs and imagemagick WORKDIR /opt @@ -43,8 +41,11 @@ ENV PATH=$NODEJS_HOME:$PATH WORKDIR /code COPY . /code +RUN gem update --system +RUN xcode-select --install +RUN gem install nokogiri + RUN gem install bundler -v 2.4.22 && \ - gem install nokogiri --platform=ruby && \ bundle install EXPOSE 80 443 3000 From 51abe6652f5d7f9b8cd69bcb2baeb1b213319cfe Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Wed, 23 Oct 2024 01:42:20 +0300 Subject: [PATCH 22/32] install gcc:amd64 & g++:amd64 as multilib depend on them --- docker/Dockerfile.arm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index 6acaac15a..c8aa4e19e 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -23,6 +23,8 @@ RUN dpkg --add-architecture amd64 RUN apt update RUN apt-get install -y libc6:amd64 RUN apt-get install -y \ + gcc:amd64 \ + g++:amd64 \ gcc-multilib:amd64 \ g++-multilib:amd64 From 13264702357853dcce0a1ba555b6655fc2569da6 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Wed, 23 Oct 2024 05:06:41 +0300 Subject: [PATCH 23/32] ditch using xcode-select as it's not available from the image --- docker/Dockerfile.arm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index c8aa4e19e..9554e7da8 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -43,11 +43,8 @@ ENV PATH=$NODEJS_HOME:$PATH WORKDIR /code COPY . /code -RUN gem update --system -RUN xcode-select --install -RUN gem install nokogiri - RUN gem install bundler -v 2.4.22 && \ + gem install nokogiri --platform=ruby && \ bundle install EXPOSE 80 443 3000 From b4792d57a0a289aadced551e7b530a6096328418 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Wed, 23 Oct 2024 05:13:52 +0300 Subject: [PATCH 24/32] don't forget to use system libraries for nokogiri compilation --- docker/Dockerfile.arm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index 9554e7da8..e58a4a810 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -44,7 +44,7 @@ WORKDIR /code COPY . /code RUN gem install bundler -v 2.4.22 && \ - gem install nokogiri --platform=ruby && \ + gem install nokogiri --platform=ruby -- --use-system-libraries && \ bundle install EXPOSE 80 443 3000 From de361aeca472a4339e5d28963b014c468694a84f Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Wed, 23 Oct 2024 05:28:51 +0300 Subject: [PATCH 25/32] added pkg-config, libxm2-dev, libxslt-dev deps --- docker/Dockerfile.arm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index e58a4a810..702a19c1e 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -26,7 +26,10 @@ RUN apt-get install -y \ gcc:amd64 \ g++:amd64 \ gcc-multilib:amd64 \ - g++-multilib:amd64 + g++-multilib:amd64 \ + pkg-config \ + libxml2-dev \ + libxslt-dev # Install nodejs and imagemagick WORKDIR /opt From 8ccc2b3e6f6de121ee5fd6da9a35e26f535be851 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Wed, 23 Oct 2024 05:47:55 +0300 Subject: [PATCH 26/32] debugging attempt --- docker/Dockerfile.arm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index 702a19c1e..da8d298ca 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -46,9 +46,13 @@ ENV PATH=$NODEJS_HOME:$PATH WORKDIR /code COPY . /code -RUN gem install bundler -v 2.4.22 && \ - gem install nokogiri --platform=ruby -- --use-system-libraries && \ - bundle install +RUN gem install bundler -v 2.4.22 + +RUN gem install nokogiri --platform=ruby -- --use-system-libraries 2> /dev/null + +RUN cat /usr/local/bundle/extensions/aarch64-linux/3.0.0/nokogiri-1.16.7/mkmf.log + +RUN bundle install EXPOSE 80 443 3000 ENTRYPOINT ["/bin/bash"] From 5663a43719e317dc23117a81421da3f5708adff5 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Wed, 23 Oct 2024 05:52:25 +0300 Subject: [PATCH 27/32] forgot to not return an error code --- docker/Dockerfile.arm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index da8d298ca..ffc59e290 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -48,7 +48,7 @@ COPY . /code RUN gem install bundler -v 2.4.22 -RUN gem install nokogiri --platform=ruby -- --use-system-libraries 2> /dev/null +RUN gem install nokogiri --platform=ruby -- --use-system-libraries 2> /dev/null || true RUN cat /usr/local/bundle/extensions/aarch64-linux/3.0.0/nokogiri-1.16.7/mkmf.log From 8c1a5dc24f6bfe3260d8647d7411237eda306f5d Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Wed, 23 Oct 2024 06:47:56 +0300 Subject: [PATCH 28/32] back to simple install --- docker/Dockerfile.arm | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index ffc59e290..d3c6d63d8 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -9,28 +9,18 @@ RUN apt-get update && \ autoconf \ bison \ build-essential \ + ruby-dev \ libssl-dev \ libyaml-dev \ libreadline-dev \ zlib1g-dev \ + liblzma-dev \ libncurses5-dev \ libffi-dev \ libgdbm-dev && \ + patch && \ apt-get install -y default-mysql-server -# Install dependencies specific to amd64 -RUN dpkg --add-architecture amd64 -RUN apt update -RUN apt-get install -y libc6:amd64 -RUN apt-get install -y \ - gcc:amd64 \ - g++:amd64 \ - gcc-multilib:amd64 \ - g++-multilib:amd64 \ - pkg-config \ - libxml2-dev \ - libxslt-dev - # Install nodejs and imagemagick WORKDIR /opt RUN wget https://nodejs.org/dist/v12.18.3/node-v12.18.3-linux-x64.tar.xz && \ @@ -48,9 +38,7 @@ COPY . /code RUN gem install bundler -v 2.4.22 -RUN gem install nokogiri --platform=ruby -- --use-system-libraries 2> /dev/null || true - -RUN cat /usr/local/bundle/extensions/aarch64-linux/3.0.0/nokogiri-1.16.7/mkmf.log +RUN gem install nokogiri --platform=ruby RUN bundle install From 481ff00fc0846aecf912b5c191ce707334993247 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Wed, 23 Oct 2024 07:14:15 +0300 Subject: [PATCH 29/32] restored libc6 installation --- docker/Dockerfile.arm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index d3c6d63d8..201c080a0 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -21,6 +21,10 @@ RUN apt-get update && \ patch && \ apt-get install -y default-mysql-server +RUN dpkg --add-architecture amd64 +RUN apt update +RUN apt install libc6:amd64 + # Install nodejs and imagemagick WORKDIR /opt RUN wget https://nodejs.org/dist/v12.18.3/node-v12.18.3-linux-x64.tar.xz && \ From 7260c2d0952ca9730daec7380f704ca644d8051b Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Wed, 23 Oct 2024 20:22:00 +0300 Subject: [PATCH 30/32] forgot about --assume-yes again --- docker/Dockerfile.arm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index 201c080a0..d82c4754a 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -23,7 +23,7 @@ RUN apt-get update && \ RUN dpkg --add-architecture amd64 RUN apt update -RUN apt install libc6:amd64 +RUN apt install -y libc6:amd64 # Install nodejs and imagemagick WORKDIR /opt From 363f7c7d489f8fd9915c3a1a5990075c905df8e6 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Wed, 23 Oct 2024 20:34:21 +0300 Subject: [PATCH 31/32] prevent nokogiri install from being overridden by bundle install --- docker/Dockerfile.arm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index d82c4754a..337acf526 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -41,10 +41,8 @@ WORKDIR /code COPY . /code RUN gem install bundler -v 2.4.22 - -RUN gem install nokogiri --platform=ruby - RUN bundle install +RUN gem install nokogiri --platform=ruby EXPOSE 80 443 3000 ENTRYPOINT ["/bin/bash"] From add426fcc5a5d0e52a06d4bd655e2b09ff265c18 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 24 Oct 2024 00:11:49 +0300 Subject: [PATCH 32/32] switch to current supported platform name for arm64 --- docker/Dockerfile.arm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index 337acf526..06b954c0b 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -1,4 +1,4 @@ -FROM --platform=linux/arm64 ruby:3.0.0 +FROM --platform=linux/arm64/v8 ruby:3.0.0 ENV RUBYOPT="-KU -E utf-8:utf-8" RUN apt-get update && \