/
Dockerfile
42 lines (32 loc) · 1.13 KB
/
Dockerfile
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
FROM ruby:3.0.2-buster as ruby_base
FROM node:16.5.0-buster as node_base
FROM buildpack-deps:buster
# -------------
# for Ruby
# -------------
COPY --from=ruby_base /usr/local/ /usr/local/
ENV RUBY_MAJOR 3.0
ENV RUBY_VERSION 3.0.2
# install things globally, for great justice
# and don't create ".bundle" in all our apps
ENV GEM_HOME /usr/local/bundle
ENV BUNDLE_PATH="$GEM_HOME" \
BUNDLE_SILENCE_ROOT_WARNING=1 \
BUNDLE_APP_CONFIG="$GEM_HOME" \
PATH=$GEM_HOME/bin:$BUNDLE_PATH/gems/bin:$PATH
# -------------
# for Node
# -------------
ENV NODE_VERSION 16.5.0
ENV YARN_VERSION 1.22.5
COPY --from=node_base /usr/local/ /usr/local/
COPY --from=node_base /opt/ /opt/
RUN cd /usr/local/bin \
&& rm nodejs npm npx yarn yarnpkg \
&& ln -s ../lib/node_modules/npm/bin/npm-cli.js npm \
&& ln -s ../lib/node_modules/npm/bin/npx-cli.js npx \
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
&& groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node