-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathDockerfile
51 lines (42 loc) · 1.51 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
FROM ruby:3.1.2
RUN apt update && apt upgrade -y
# Yarn & nodejs setup
RUN curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor -o /usr/share/keyrings/yarnkey.gpg
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN apt update -y
RUN apt install -y rsync netcat nodejs yarn redis-server --no-install-recommends
ARG MYSQL_ROOT_PASSWORD
ENV PASSWORD=$MYSQL_ROOT_PASSWORD
ARG TIOJ_KEY
ENV TIOJ_KEY=$TIOJ_KEY
COPY Gemfile Gemfile.lock package.json yarn.lock /tioj/
WORKDIR /tioj
RUN MAKEFLAGS='-j2' bundle install
RUN yarn install --frozen-lockfile
COPY . /tioj
RUN echo "default: &default\n\
adapter: mysql2\n\
host: db\n\
username: root\n\
password: $PASSWORD\n\
encoding: utf8mb4\n\
\n\
development:\n\
<<: *default\n\
database: tioj_dev\n\
test:\n\
<<: *default\n\
database: tioj_test\n\
production:\n\
<<: *default\n\
database: tioj_production"\
> config/database.yml
RUN EDITOR=true rails credentials:edit
RUN rails assets:precompile
# Move public/ to public-tmp/ since we're going to override it with 'volumes';
# run_server moves it back
RUN mv public public-tmp
CMD /tioj/scripts/run_server.sh 1