From fa3b53d3b378fe5d6ad226a821b822181fd6b271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Fri, 2 Dec 2022 19:19:02 +0100 Subject: [PATCH] Add Dockerfile for development --- Dockerfile | 21 +++++++++++++++++++++ config/environments/development.rb | 3 +++ docker/entrypoint.sh | 8 ++++++++ 3 files changed, 32 insertions(+) create mode 100644 Dockerfile create mode 100644 docker/entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ddb8df6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# syntax=docker/dockerfile:1 +FROM ruby:2.7 +RUN apt-get update -qq && apt-get install -y curl ldap-utils +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 +COPY package.json /akkounts/package.json +RUN bundle install +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"] +EXPOSE 3000 + +# Configure the main process to run when running the image +CMD ["bin", "dev"] diff --git a/config/environments/development.rb b/config/environments/development.rb index 8cad9e3..80a7540 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -63,4 +63,7 @@ Rails.application.configure do config.action_mailer.raise_delivery_errors = false # Base URL to be used by email template link helpers config.action_mailer.default_url_options = { host: "localhost:3000", protocol: "http" } + + # Allow requests from any IP + config.web_console.whiny_requests = false end diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 0000000..3af18f7 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,8 @@ +#!/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 "$@"