Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Justin improve docker image #574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
justin808 wants to merge 27 commits into master from justin-improve-docker-image
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
589813e
Prepare db only if rails server is running
ahangarha Oct 29, 2023
3a71934
Update root Dockerfile based on Rails Dockerfile
ahangarha Oct 29, 2023
62175bf
Remove bootsnap related lines
ahangarha Oct 29, 2023
1fec261
Use bin/rails
ahangarha Oct 29, 2023
547e992
Fix execution of the command for generative locale
ahangarha Oct 29, 2023
e6907ed
Remove storage dir from the chown command
ahangarha Oct 29, 2023
44af5a0
Move node installation to the base stage
ahangarha Nov 16, 2023
c5c0d4b
Rename the working dir to /app
ahangarha Nov 16, 2023
8c231c9
Move build steps into cpln dockerfile
ahangarha Dec 9, 2023
5ece4c3
Move customizations into dedicated Dockerfiles
ahangarha Dec 9, 2023
7419760
Use full command for rails server
ahangarha Dec 9, 2023
7f9615f
Use bash to run the entrypoint script
ahangarha Dec 9, 2023
4834479
Add documentation for using base docker image
ahangarha Dec 9, 2023
9d21b0f
Add yarn res:build to the new dockerfile
ahangarha Dec 10, 2023
803e46b
Improve documentation
ahangarha Dec 15, 2023
a1043fe
Change the repository of the base image
ahangarha Dec 15, 2023
0f59a18
Add maintainer guideline
ahangarha Dec 15, 2023
25a43b4
WIP
justin808 Dec 25, 2023
98290a4
Updated Docker file
justin808 Dec 26, 2023
6d9cdd4
Add Docker Build
justin808 Dec 28, 2023
c2d7e31
WIP
justin808 Dec 28, 2023
d1b3729
WIP
justin808 Dec 28, 2023
fb81a81
WIP
justin808 Dec 28, 2023
ce0b8a3
WIP
justin808 Dec 28, 2023
d3d5d8c
WIP
justin808 Dec 28, 2023
b9b63c1
WIP
justin808 Dec 28, 2023
e284c32
WIP
justin808 Dec 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move build steps into cpln dockerfile
  • Loading branch information
ahangarha authored and justin808 committed Dec 28, 2023
commit 8c231c9b82e64d0e7640e4e5dbb710c756f7cbb7
30 changes: 4 additions & 26 deletions .controlplane/Dockerfile
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
FROM ruby:3.1.2

RUN apt-get update

# install node and yarn
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash
RUN apt-get install -y nodejs
RUN npm install -g yarn

WORKDIR /app

# install ruby gems
COPY Gemfile* ./

RUN bundle config set without 'development test' && \
bundle config set with 'staging production' && \
bundle install --jobs=3 --retry=3

# install node packages
COPY package.json yarn.lock ./
RUN yarn install

COPY . ./
FROM ahangarha/rwrt-base:latest

ENV RAILS_ENV=production
ENV NODE_ENV=production
Expand All @@ -29,11 +7,11 @@ ENV NODE_ENV=production
ENV SECRET_KEY_BASE=NOT_USED_NON_BLANK

RUN yarn res:build
RUN rails react_on_rails:locale
RUN rails assets:precompile
RUN bin/rails react_on_rails:locale
RUN bin/rails assets:precompile

# add entrypoint
COPY .controlplane/entrypoint.sh ./
ENTRYPOINT ["/app/entrypoint.sh"]

CMD ["rails", "s"]
CMD ["./bin/rails", "s"]
16 changes: 0 additions & 16 deletions Dockerfile
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ RUN yarn install --frozen-lockfile
# Copy application code
COPY . .

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails react_on_rails:locale
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile

# Final stage for app image
FROM base

Expand All @@ -58,15 +54,3 @@ RUN apt-get update -qq && \
# Copy built artifacts: gems, application
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build /app /app

# Run and own only the runtime files as a non-root user for security
RUN useradd rails --create-home --shell /bin/bash && \
chown -R rails:rails db log tmp
USER rails:rails

# Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["./bin/rails", "server"]

AltStyle によって変換されたページ (->オリジナル) /