Skip to content
This repository was archived by the owner on May 4, 2024. It is now read-only.

Commit f9b12c2

Browse files
Update Dockerfile with webpacker assets
1 parent 9ac4acd commit f9b12c2

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM ruby:3.0-alpine
33
MAINTAINER Florian Dejonckheere <[email protected]>
44
LABEL org.opencontainers.image.source https://github.com/floriandejonckheere/code-red
55

6-
ENV RUNTIME_DEPS postgresql openssh
6+
ENV RUNTIME_DEPS postgresql
77
ENV BUILD_DEPS build-base curl-dev git postgresql-dev cmake nodejs yarn
88

99
ENV LC_ALL en_US.UTF-8

Dockerfile.prod

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM ruby:3.0-alpine AS gems
1+
FROM ruby:3.0-alpine AS ruby
22

33
WORKDIR /app/
44

55
# Install system dependencies
6-
RUN apk add --no-cache build-base curl-dev git postgresql-dev postgresql
6+
RUN apk add --no-cache build-base curl-dev git postgresql-dev cmake
77

88
# Install Bundler
99
RUN gem update --system && gem install bundler
@@ -17,22 +17,38 @@ RUN bundle config set --local without "development test" && \
1717
bundle config set --local deployment true && \
1818
bundle install
1919

20-
FROM gems AS assets
20+
FROM ruby AS node
21+
22+
# Install Yarn
23+
RUN apk add --no-cache nodejs yarn
24+
25+
# Install NPM dependencies
26+
ADD package.json /app/
27+
ADD yarn.lock /app/
28+
29+
RUN yarn install
30+
31+
FROM node AS assets
2132

2233
# Only add files that affect the assets:precompile task
2334
ADD Rakefile /app/Rakefile
35+
ADD postcss.config.js /app/postcss.config.js
2436
ADD config/application.rb /app/config/application.rb
2537
ADD config/boot.rb /app/config/boot.rb
2638
ADD config/environment.rb /app/config/environment.rb
2739
ADD config/environments/production.rb /app/config/environments/production.rb
2840
ADD config/initializers/assets.rb /app/config/initializers/assets.rb
2941
ADD config/locales /app/config/locales
42+
ADD config/webpacker.yml /app/config/webpacker.yml
43+
ADD config/webpack /app/config/webpack
3044
ADD app/assets /app/app/assets
45+
ADD app/javascript /app/app/javascript
46+
ADD bin/webpack /app/bin/webpack
3147

3248
ARG SECRET_KEY_BASE
33-
RUN rake assets:precompile
49+
RUN NODE_ENV=production rake assets:precompile
3450

35-
FROM gems
51+
FROM ruby
3652

3753
ENV LC_ALL en_US.UTF-8
3854
ENV LANG en_US.UTF-8
@@ -55,6 +71,7 @@ ADD . /app/
5571

5672
# Copy assets
5773
COPY --from=assets /app/public/assets /app/public/assets
74+
COPY --from=assets /app/public/packs /app/public/packs
5875

5976
RUN mkdir -p /app/tmp/pids/
6077
RUN chown -R $UID:$GID /app/

0 commit comments

Comments
 (0)