From c17c980b690c24f8633d7c1c43c4b879f51ae449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Tue, 28 Mar 2023 11:24:35 +0200 Subject: [PATCH] Prepare for multiple akkounts containers Initially "web" and "sidekiq" --- Dockerfile | 15 +++++++-------- docker-compose.yml | 32 ++++++++++++++++---------------- docker/entrypoint.sh | 8 -------- 3 files changed, 23 insertions(+), 32 deletions(-) delete mode 100644 docker/entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 0eead4c..f2692e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,13 @@ # syntax=docker/dockerfile:1 FROM ruby:2.7.6 -RUN apt-get update -qq && apt-get install -y curl ldap-utils + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +RUN apt-get update -qq && apt-get install -y --no-install-recommends curl \ + ldap-utils tini RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - RUN apt-get update && apt-get install -y nodejs + WORKDIR /akkounts COPY Gemfile /akkounts/Gemfile COPY Gemfile.lock /akkounts/Gemfile.lock @@ -12,11 +17,5 @@ RUN gem install foreman RUN npm install -g yarn RUN yarn install -# Add a script to be executed every time the container starts. -COPY docker/entrypoint.sh /usr/bin/ -RUN chmod +x /usr/bin/entrypoint.sh -ENTRYPOINT ["entrypoint.sh"] +ENTRYPOINT ["/usr/bin/tini", "--"] EXPOSE 3000 - -# Configure the main process to run when running the image -CMD ["bin", "dev"] diff --git a/docker-compose.yml b/docker-compose.yml index a4d5a29..c4864b7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,19 +16,19 @@ services: # PHPLDAPADMIN_HTTPS: false # PHPLDAPADMIN_LDAP_HOSTS: "#PYTHON2BASH:[{'ldap': [{'server': [{'tls': False}, {'port': 3389}]}, {'login': [{'bind_id': 'cn=Directory Manager'}, {'bind_pass': 'passthebutter'}]}]}]" # PHPLDAPADMIN_LDAP_CLIENT_TLS: false - # web: - # build: . - # tty: true - # command: bash -c "sleep 5 && rm -f tmp/pids/server.pid && bin/dev" - # volumes: - # - .:/akkounts - # ports: - # - "3000:3000" - # environment: - # RAILS_ENV: development - # LDAP_HOST: ldap - # LDAP_PORT: 3389 - # LDAP_ADMIN_PASSWORD: passthebutter - # LDAP_USE_TLS: "false" - # depends_on: - # - ldap + web: + build: . + tty: true + command: bash -c "rm -f /akkounts/tmp/pids/server.pid; bin/dev" + volumes: + - .:/akkounts + ports: + - "3000:3000" + environment: + RAILS_ENV: development + LDAP_HOST: ldap + LDAP_PORT: 3389 + LDAP_ADMIN_PASSWORD: passthebutter + LDAP_USE_TLS: "false" + depends_on: + - ldap diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh deleted file mode 100644 index 3af18f7..0000000 --- a/docker/entrypoint.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -e - -# Remove a potentially pre-existing server.pid for Rails. -rm -f /myapp/tmp/pids/server.pid - -# Then exec the container's main process (what's set as CMD in the Dockerfile). -exec "$@"