-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
87 lines (67 loc) · 1.78 KB
/
Dockerfile
File metadata and controls
87 lines (67 loc) · 1.78 KB
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
# syntax=docker/dockerfile:1
ARG port
ARG rails_env
FROM ruby:3.2.2 AS build
# Install requirements
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | sh -
RUN apt-get update \
&& apt-get -y install nodejs \
&& apt-get -y install postgresql-client \
&& npm install -g yarn \
&& gem install rails -v 7.1.0
# Create Rails skeleton
WORKDIR /mnt
RUN rails new spree -j esbuild \
--skip-bundle \
--skip-git \
--skip-keeps \
--skip-rc \
--skip-spring \
--skip-test \
--skip-coffee \
--skip-bootsnap
# Create plugin folder
RUN mkdir /mnt/spree-ecomprocessing-plugin
# Prepare Spree platform
WORKDIR /mnt/spree
RUN <<RUBY cat >> Gemfile
gem 'spree', '4.8.3'
gem 'spree_frontend', '4.8.0'
gem 'spree_backend', '4.8.3'
gem 'spree_sample', '4.8.3'
gem 'spree_auth_devise', '4.6.3'
gem 'pg'
gem 'spree_ecomprocessing_genesis', path: '/mnt/spree-ecomprocessing-plugin'
RUBY
# Copy Database config
RUN rm config/database.yml || true
COPY docker/database.yml config/
# Configure scripts
COPY docker/install_direct_method.sh /bin/
RUN chmod +x /bin/install_direct_method.sh
COPY docker/install_checkout_method.sh /bin/
RUN chmod +x /bin/install_checkout_method.sh
FROM build as setup
COPY --from=build /mnt/spree /mnt/spree
WORKDIR /mnt/spree
# Configure entrypoint
COPY docker/docker-entrypoint.sh /bin/
RUN chmod +x /bin/docker-entrypoint.sh
FROM setup as install
# Copy plugin
COPY . /mnt/spree-ecomprocessing-plugin
FROM install as production
ENV RAILS_ENV $spree_env
ENTRYPOINT ["/bin/docker-entrypoint.sh"]
# Start PUMA
EXPOSE $port
CMD ["puma"]
FROM setup as development
ENV RAILS_ENV $spree_env
WORKDIR /mnt/spree
# Add pry debug
RUN echo "gem 'pry'" >> Gemfile
ENTRYPOINT ["/bin/docker-entrypoint.sh"]
# Start Rails server
EXPOSE $port
CMD ["rails", "server", "-b", "0.0.0.0"]