Skip to content

Commit 7e3c019

Browse files
committed
source node binaries from pinned alpine image
1 parent 0bffe8b commit 7e3c019

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

Dockerfile

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
ARG ROOT=/usr/src/app/
22

3-
FROM ruby:3.3.8-alpine AS builder
3+
# available alpine packages: https://pkgs.alpinelinux.org/packages
4+
5+
FROM node:24-alpine AS node-source
6+
7+
FROM ruby:3.3.8-alpine AS build
48
ARG ROOT
59
WORKDIR $ROOT
610

@@ -13,17 +17,13 @@ FROM ruby:3.3.8-alpine AS builder
1317
postgresql-dev \
1418
tzdata
1519

16-
1720
COPY Gemfile* $ROOT
1821
RUN bundle install
1922

2023
FROM ruby:3.3.8-alpine
2124
ARG ROOT
2225
WORKDIR $ROOT
2326

24-
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main/ nodejs=24.13.0-r2 npm
25-
26-
# available: https://pkgs.alpinelinux.org/packages
2727
RUN apk update && apk upgrade && apk add --update --no-cache \
2828
bash \
2929
build-base \
@@ -35,11 +35,12 @@ FROM ruby:3.3.8-alpine
3535
&& rm -rf /var/cache/apk/*
3636

3737
COPY . .
38-
RUN npm install --global npm@latest
39-
RUN npm install
40-
RUN npm run build && npm run build:css
38+
COPY --from=node-source /usr/local/bin/node /usr/local/bin/node
39+
COPY --from=node-source /usr/local/lib/node_modules /usr/local/lib/node_modules
40+
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
41+
RUN npm ci
4142

42-
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
43+
COPY --from=build /usr/local/bundle/ /usr/local/bundle/
4344

4445
EXPOSE 3000
4546

0 commit comments

Comments
 (0)