-
-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathDockerfile.dev
More file actions
63 lines (48 loc) · 1.79 KB
/
Dockerfile.dev
File metadata and controls
63 lines (48 loc) · 1.79 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
FROM ruby:3.1.2-bullseye AS ruby
FROM node:12.18.3-slim AS node
FROM ruby AS build
# Set all encoding to UTF-8
ENV RUBYOPT="-KU -E utf-8:utf-8"
# Install additional dependencies not present in the base image
RUN apt-get update && \
apt-get install -y bison \
build-essential \
libxslt-dev \
default-mysql-server \
firefox-esr
# Add core code to container
WORKDIR /code
COPY . /code
RUN gem install bundler:2.4.13
RUN bundle install
# cherry pick only what we really need to run Node.js
COPY --from=node /usr/local/bin/node /usr/local/bin
COPY --from=node /usr/local/include/node /usr/local/include
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node /usr/local/share/doc/node /usr/local/share/doc
COPY --from=node /usr/local/share/man/man1/node.1 /usr/local/share/man/man1
COPY --from=node /usr/local/share/systemtap/tapset/node.stp /usr/local/share/systemtap/tapset
COPY --from=node /opt/yarn-v1.22.4 /opt/yarn-v1.22.4
# create symlinks needed to run Node.js & NPM
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
RUN ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx
RUN ln -s /opt/yarn-v1.22.4/bin/yarn /usr/local/bin/yarn
RUN ln -s /opt/yarn-v1.22.4/bin/yarnpkg /usr/local/bin/yarnpkg
RUN ln -s /usr/local/bin/node /usr/local/bin/nodejs
FROM build
# setup a dedicated user for Node.js
RUN groupadd --gid 1000 node
RUN useradd --uid 1000 \
--gid node \
--shell /bin/bash \
--create-home node
# setup Node.js environment
ENV NODEJS_HOME=/usr/local/bin/node
ENV PATH=$NODEJS_HOME:$PATH
WORKDIR /code
EXPOSE 80 443 3000
RUN ls -1 /
RUN [ ! -f "/db-created" ] && echo 1 || echo 2
RUN /code/docker/entrypoint.sh dev
# ensures continued running of the container
CMD sleep 7d