-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
67 lines (51 loc) · 1.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
##################
### Base image ###
##################
FROM ruby:3.0.2-alpine as base
# 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/*
# Create a working directory
WORKDIR /tap
# Copy the gemfile to the working directory
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock
# Install dependencies
# Use BuildKit cache for caching dependencies
RUN --mount=type=cache,target=vendor/cache bundle install
# 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
########################
### Production image ###
########################
FROM base as production
# Copy the sourcecode
COPY . .
# 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