This repository has been archived by the owner on Aug 24, 2018. It is now read-only.
forked from ryanj/origin-s2i-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile.fedora.onbuild
57 lines (45 loc) · 1.82 KB
/
Dockerfile.fedora.onbuild
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
FROM fedora
EXPOSE 8080
ENV NPM_RUN=start \
NODE_VERSION= \
NPM_VERSION= \
V8_VERSION= \
NODE_LTS= \
NPM_CONFIG_LOGLEVEL=info \
NPM_CONFIG_PREFIX=$HOME/.npm-global \
PATH=$HOME/bin:$HOME/../bin:$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \
DEBUG_PORT=5858 \
NODE_ENV=production \
STI_SCRIPTS_PATH=/usr/libexec/s2i \
DEV_MODE=false
LABEL io.k8s.description="Platform for building and running Node.js applications" \
io.k8s.display-name="Node.js $NODE_VERSION" \
io.openshift.s2i.scripts-url=image:///usr/libexec/s2i \
io.openshift.expose-services="8080:http" \
io.openshift.tags="builder,nodejs,nodejs-$NODE_VERSION" \
com.redhat.deployments-dir="/opt/app-root/src" \
maintainer="Lance Ball <lball@redhat.com>"
# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH
COPY ./s2i/ $STI_SCRIPTS_PATH
# Each language image can have 'contrib' a directory with extra files needed to
# run and build the applications.
COPY ./contrib/ /opt/app-root
RUN set -ex ; \
HOME=/opt/app-root/src ; \
mkdir -p ${HOME} ; \
dnf -q install -y --setopt=tsflags=nodocs nss_wrapper gpg findutils ; \
dnf -q clean all -y ; \
echo "default:x:1001:0:Default application user:/opt/app-root/src:/bin/bash" | cat >> /etc/passwd ; \
/opt/app-root/etc/install_node.sh ; \
/opt/app-root/etc/set_passwd_permissions.sh ; \
chown -R 1001:0 /opt/app-root && chmod -R ug+rwx /opt/app-root
USER 1001
WORKDIR /opt/app-root/src
# Set the default CMD to print the usage of the language image
CMD $STI_SCRIPTS_PATH/usage
ONBUILD COPY package.json /opt/app-root/src
ONBUILD COPY . /opt/app-root/src
ONBUILD RUN chown -R 1001:0 /opt/app-root && chmod -R ug+rwx /opt/app-root
ONBUILD USER 1001
ONBUILD RUN npm -s install
CMD ["/bin/bash", "-c", "npm run -d $NPM_RUN" ]