-
Notifications
You must be signed in to change notification settings - Fork 33
/
Dockerfile
57 lines (48 loc) · 1.66 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
ARG CHIPSET=default
# Use the correct base image depending on the architecture
# For Apple M1 Chip, run: docker build --build-arg CHIPSET=m1 .
FROM ruby:3.2.5-slim AS base_default
FROM --platform=linux/amd64 ruby:3.2.5-slim AS base_m1
FROM base_${CHIPSET} AS base
COPY .nvmrc /.nvmrc
# Install required software:
# - net-tools: to run ping and other networking tools
# - build-essential: to have a compiling environment for building gems
# - curl: for healthcheck
# - netcat: for wait for connection to database
# - nodejs, yarn, git, default-libmysqlclient-dev and graphviz are rails gems dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
default-libmysqlclient-dev \
git \
graphviz \
net-tools \
netcat-traditional \
nodejs \
npm \
ruby-dev \
vim \
wget \
yarn
# switch shell to bash, to use source command
SHELL ["/bin/bash", "--login", "-i", "-c"]
# install nvm, in order to install the correct version of nodejs, rather than the image default
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
# install nodejs, using the version in the .nvmrc file
RUN source /root/.bashrc && nvm install
SHELL ["/bin/bash", "--login", "-c"]
WORKDIR /code
COPY Gemfile /code
COPY Gemfile.lock /code
ADD . /code/
# Install Chrome for being able to run tests
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt update
RUN apt install -y ./google-chrome-stable_current_amd64.deb
RUN rm ./google-chrome-stable_current_amd64.deb
# Rails installation
RUN npm install --global yarn
RUN gem install bundler
RUN bundle install
RUN yarn --install