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.centos7.onbuild
64 lines (50 loc) · 2.15 KB
/
Dockerfile.centos7.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
58
59
60
61
62
63
64
FROM openshift/base-centos7
# This image provides a Node.JS environment you can use to run your Node.JS
# applications.
EXPOSE 8080
# This image will be initialized with "npm run $NPM_RUN"
# See https://docs.npmjs.com/misc/scripts, and your repo's package.json
# file for possible values of NPM_RUN
ENV NPM_RUN=start \
NODE_VERSION= \
NPM_VERSION= \
V8_VERSION= \
NODE_LTS= \
NPM_CONFIG_LOGLEVEL=info \
NPM_CONFIG_PREFIX=$HOME/.npm-global \
PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \
DEBUG_PORT=5858 \
NODE_ENV=production \
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.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 ; \
/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
# When the container starts, we always want to make sure the permissions
# are correct in places we care about
# ENTRYPOINT ["/opt/app-root/etc/configure_passwd.sh"]
# Set the default CMD to print the usage of the language image
CMD ${STI_SCRIPTS_PATH}/usage
# Each language image can have 'contrib' a directory with extra files needed to
# run and build the applications.
COPY ./contrib/ /opt/app-root
ONBUILD COPY package.json /opt/app-root/src
ONBUILD COPY . /opt/app-root/src
# Drop the root user and make the content of /opt/app-root owned by user 1001
# Do this after we've copied the local directory to avoid UID conflicts
ONBUILD RUN chown -R 1001:0 /opt/app-root && chmod -R ug+rwx /opt/app-root
ONBUILD USER 1001
# Install the app
ONBUILD RUN npm -s install
CMD ["/bin/bash", "-c", "npm run -d $NPM_RUN" ]