-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
90 lines (71 loc) · 2.63 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#
# 2023-01-17 Found about docker caching and it changed my life! https://blog.saeloun.com/2022/07/12/docker-cache.html
#
#
#
#
#
FROM ruby:3.1.2-slim
#FROM ruby:3.1.2
# HAs Ubumntu, ruby1.8, ... and I trust the guy who built it :P
#FROM palladius/septober:v1.2
# https://docs.docker.com/build/cache/
# requires DOCKER_BUILDKIT=1
# RUN \
# --mount=type=cache,target=/var/cache/apt \
# apt-get update && apt-get install -y git
RUN --mount=type=cache,target=/var/cache/apt \
apt-get update \
&& apt-get install -qq -y --no-install-recommends \
build-essential \
nodejs \
libpq-dev \
git \
tzdata \
libxml2-dev \
libxslt-dev \
libsqlite3-dev \
npm \
ssh \
&& rm -rf /var/lib/apt/lists/*
# install YARN through NPM.
## alternatvely: curl -o- -L https://yarnpkg.com/install.sh | bash
RUN npm install --global yarn
ENV APP_HOME /opt/pasta
RUN mkdir -p $APP_HOME
WORKDIR $APP_HOME
# change to . if you move Dockerfile to /
ADD Gemfile $APP_HOME
ADD Gemfile.lock $APP_HOME
ENV GEM_HOME /opt/pasta/vendor/bundle
ENV PATH $GEM_HOME/bin:$PATH
ENV BUNDLE_PATH $GEM_HOME
ENV BUNDLE_BIN $BUNDLE_PATH/bin
ENV DESCRIPTION "This experiment was tried in 2019. Not sure it works today"
# This doesnt work!!
RUN gem install bundler
# https://stackoverflow.com/questions/52051122/cant-find-gem-railties-0-a-with-executable-rails-gemgemnotfoundexceptio
# [DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local path 'vendor/bundle'`, and stop using this flag
#RUN bundle install --path vendor/bundle
RUN bundle config set --local path 'vendor/bundle'
# COPY --from=gem-cache /usr/local/bundle /usr/local/bundle
# TODO cache also this https://blog.saeloun.com/2022/07/12/docker-cache.html
# RUN --mount=type=cache,target=/usr/local/bundle \
#RUN echo Riccardo add cache here too. neded to catch train
#RUN bundle install
RUN --mount=type=cache,target=/opt/pasta/vendor/bundle \
bundle install
# or try: RUN bundle check || bundle install
# Then I add the rest
ADD . $APP_HOME
# See from MAkefile: hobo should work both 1.1.0 and 1.0.0 maybe also 1.3.0: https://rubygems.org/gems/hobo/versions
#RUN gem install hobo 1.1.0
#RUN gem install -v=2.3.18 rails
#RUN gem install will_paginate -v 2.3.11
#RUN gem install sqlite3-ruby -v 1.2.5
EXPOSE 8080
# ./entrypoint-8080.sh doesnt work as requires lolcat
#ENTRYPOINT [ "rails", "s", "-p", "8080" ]
ENTRYPOINT [ "./entrypoint-8080.sh"]
CMD ["/bin/bash"]
#CMD ["echo", "Ciao a tutti. Change CMD if you want to run bash or something.." ]