-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5dda46d
commit dbadae2
Showing
1 changed file
with
10 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,18 @@ | ||
################## | ||
### Base image ### | ||
################## | ||
FROM ruby:3.0.2-alpine as base | ||
FROM ruby:3.3.2 | ||
|
||
# Install the required packages for building | ||
# Delete APK cache at the end (for smaller production images) | ||
RUN apk update && \ | ||
apk add --virtual build-dependencies build-base && \ | ||
apk add shared-mime-info mariadb-dev sqlite-dev nodejs tzdata imagemagick && \ | ||
rm -rf /var/cache/apk/* | ||
ENV RAILS_ENV=production | ||
|
||
# Create a working directory | ||
WORKDIR /tap | ||
RUN apt update && apt install -y nodejs cron | ||
|
||
# Copy the gemfile to the working directory | ||
COPY Gemfile Gemfile | ||
COPY Gemfile.lock Gemfile.lock | ||
WORKDIR /app | ||
|
||
# Install dependencies | ||
# Use BuildKit cache for caching dependencies | ||
RUN --mount=type=cache,target=vendor/cache bundle install | ||
COPY ./Gemfile ./Gemfile.lock /app/ | ||
|
||
# Copy all of the .gem files needed to run the application into the vendor/cache directory. | ||
# In the future, when running [bundle install(1)][bundle-install], use the gems in the cache in preference to the ones on rubygems.org | ||
RUN bundle cache | ||
RUN gem install bundler | ||
RUN bundle install | ||
|
||
######################## | ||
### Production image ### | ||
######################## | ||
FROM base as production | ||
COPY . /app | ||
|
||
# Copy the sourcecode | ||
COPY . . | ||
RUN bundle exec rails assets:precompile | ||
|
||
# Run rails in production mode | ||
ENV RAILS_ENV production | ||
|
||
# Expose port 80 | ||
# This is the main port for the application | ||
EXPOSE 80 | ||
|
||
# Pre-compile assets | ||
RUN rake assets:precompile | ||
|
||
# Docker Entrypoint | ||
# Will be started when the container is started | ||
ENTRYPOINT sh docker-start.sh | ||
|
||
######################### | ||
### Development image ### | ||
######################### | ||
FROM base as development | ||
|
||
# Copy the sourcecode | ||
COPY . . | ||
|
||
# Run rails in production mode | ||
ENV RAILS_ENV development | ||
|
||
# Expose port 80 | ||
# This is the main port for the application | ||
EXPOSE 80 | ||
|
||
# Docker Entrypoint | ||
# Will be started when the container is started | ||
CMD sh docker-start.sh | ||
CMD bundle exec rails s -b 0.0.0.0 |