Skip to content

Commit 4d5d9b6

Browse files
committed
Significantly reduced image size
1 parent e47ad65 commit 4d5d9b6

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

Dockerfile

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
1-
FROM ruby:2.7.5-alpine3.13
1+
FROM ruby:3.0.4-alpine3.15
22

33
MAINTAINER Andrew Kane <andrew@ankane.org>
44

5-
RUN apk add --update ruby-dev build-base \
6-
libxml2-dev libxslt-dev pcre-dev libffi-dev \
7-
postgresql-dev mysql-dev sqlite-dev git \
8-
unixodbc-dev freetds-dev
9-
10-
RUN gem install bundler
11-
12-
ENV INSTALL_PATH /app
5+
ARG INSTALL_PATH=/app
6+
ARG RAILS_ENV=production
7+
ARG DATABASE_URL=postgresql://user:pass@127.0.0.1/dbname
8+
ARG SECRET_TOKEN=dummytoken
139

1410
RUN mkdir -p $INSTALL_PATH
1511

1612
WORKDIR $INSTALL_PATH
1713

18-
COPY Gemfile Gemfile.lock ./
19-
20-
RUN bundle install --binstubs
21-
2214
COPY . .
2315

24-
RUN bundle exec rake RAILS_ENV=production DATABASE_URL=postgresql://user:pass@127.0.0.1/dbname SECRET_TOKEN=dummytoken assets:precompile
16+
RUN apk add --update ruby-dev build-base libxml2-dev libxslt-dev pcre-dev libffi-dev libpq-dev mariadb-dev sqlite-dev git unixodbc-dev libpq mariadb-connector-c sqlite-libs unixodbc && \
17+
gem install bundler && \
18+
bundle install && \
19+
bundle exec rails app:update:bin && \
20+
bundle exec rake assets:precompile && \
21+
apk del ruby-dev build-base libxml2-dev libxslt-dev pcre-dev libffi-dev libpq-dev mariadb-dev sqlite-dev git unixodbc-dev unixodbc-dev && \
22+
rm -rf /var/cache/apk/*
2523

2624
ENV PORT 8080
2725

0 commit comments

Comments
 (0)