-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (37 loc) · 1.46 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
ARG RUBY_VERSION=3.2.2
FROM ruby:$RUBY_VERSION-slim
ARG RAILS_VERSION=7
ARG BUNDLER_VERSION=2
ARG NODE_VERSION=19
ARG PG_VERSION=15
# Install dependencies
RUN apt-get update -qq && \
apt-get install -y build-essential libvips gnupg2 curl git && \
apt-get clean
# Add PostgreSQL to sources list
RUN curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
. /etc/os-release && \
echo "deb http://apt.postgresql.org/pub/repos/apt/ $VERSION_CODENAME-pgdg main" $PG_VERSION > /etc/apt/sources.list.d/pgdg.list
# Install PostgreSQL
RUN apt-get update -qq && \
apt-get install -y libpq-dev postgresql-client-$PG_VERSION && \
apt-get clean
# Ensure node.js is available for apt-get
RUN curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash -
# Install node and npm
RUN apt-get update -qq && apt-get install -y nodejs && npm install -g npm@$NPM_VERSION
# Mount $PWD to this workdir
WORKDIR /rails
# Ensure gems are installed on a persistent volume and available as bins
VOLUME /bundle
ENV PATH="/bundle/ruby/$RUBY_VERSION/bin:${PATH}"
ENV BUNDLE_PATH="/bundle"
# Install Bundler & Rails
RUN gem update --system && \
gem uninstall bundler && \
gem install bundler -v $BUNDLER_VERSION && \
gem install rails -v $RAILS_VERSION
# Ensure binding is always 0.0.0.0, even in development, to access server from outside container
ENV BINDING="0.0.0.0"
# Overwrite ruby image's entrypoint to provide open cli
ENTRYPOINT [""]