Skip to content
Merged
Changes from all commits
Commits
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
85 changes: 42 additions & 43 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,49 +1,48 @@
FROM ruby:3.3.8-alpine AS builder
ARG ROOT=/usr/src/app/

RUN apk update && apk upgrade && apk add --update --no-cache \
build-base \
curl-dev \
libffi-dev \
yaml-dev \
linux-headers \
postgresql-dev \
tzdata
# available alpine packages: https://pkgs.alpinelinux.org/packages

ARG RAILS_ROOT=/usr/src/app/
WORKDIR $RAILS_ROOT
FROM node:24-alpine AS node-source

COPY Gemfile* $RAILS_ROOT
RUN bundle install
FROM ruby:3.3.8-alpine AS build
ARG ROOT
WORKDIR $ROOT

### BUILD STEP DONE ###
RUN apk update && apk upgrade && apk add --update --no-cache \
build-base \
curl-dev \
libffi-dev \
yaml-dev \
linux-headers \
postgresql-dev \
tzdata

FROM ruby:3.3.8-alpine

ARG RAILS_ROOT=/usr/src/app/

RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main/ nodejs=24.13.0-r2 npm

# available: https://pkgs.alpinelinux.org/packages
RUN apk update && apk upgrade && apk add --update --no-cache \
bash \
build-base \
curl \
imagemagick \
postgresql-client \
tzdata \
vim \
&& rm -rf /var/cache/apk/*

WORKDIR $RAILS_ROOT
COPY Gemfile* $ROOT
RUN bundle install

COPY . .
RUN npm install --global npm@latest
RUN npm install
RUN npm run build && npm run build:css

COPY --from=builder /usr/local/bundle/ /usr/local/bundle/

EXPOSE 3000

ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["bin/rails", "s", "-b", "0.0.0.0"]
FROM ruby:3.3.8-alpine
ARG ROOT
WORKDIR $ROOT

RUN apk update && apk upgrade && apk add --update --no-cache \
bash \
build-base \
curl \
imagemagick \
postgresql-client \
tzdata \
vim \
&& rm -rf /var/cache/apk/*

COPY . .
COPY --from=node-source /usr/local/bin/node /usr/local/bin/node
COPY --from=node-source /usr/local/lib/node_modules /usr/local/lib/node_modules
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
RUN npm ci

COPY --from=build /usr/local/bundle/ /usr/local/bundle/

EXPOSE 3000

ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["bin/rails", "s", "-b", "0.0.0.0"]
Loading