-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #358 from razee-io/non-root
Non root
- Loading branch information
Showing
8 changed files
with
6,333 additions
and
3,987 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
* | ||
!.build | ||
!private/scripts | ||
build-tools/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
extends: relaxed | ||
|
||
rules: | ||
line-length: | ||
max: 180 | ||
level: warning | ||
empty-lines: | ||
max: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,52 @@ | ||
FROM node:12-alpine | ||
############################################################################### | ||
# Copyright 2019 IBM Corp. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
################################################################################ | ||
####################################### | ||
# Build the preliminary image | ||
####################################### | ||
FROM node:12-alpine as buildImg | ||
|
||
LABEL maintainer="Michael McKay <mckaymic@us.ibm.com>" | ||
RUN apk update | ||
RUN apk add python3 make g++ | ||
|
||
ARG BUILD_ID | ||
ARG LAST_COMMIT_ID | ||
|
||
ENV METEORD_DIR="/opt/meteord" BUILD_PACKAGES="python3 make g++" | ||
USER node | ||
WORKDIR /home/node | ||
|
||
COPY --chown=node .build/bundle /home/node/app | ||
|
||
WORKDIR /root | ||
RUN cd app/programs/server/ && npm install | ||
|
||
COPY ./private/scripts $METEORD_DIR | ||
COPY .build/bundle /app | ||
####################################### | ||
# Build the production image | ||
####################################### | ||
FROM node:12-alpine | ||
LABEL maintainer="Michael McKay <mckaymic@us.ibm.com>" | ||
|
||
USER node | ||
WORKDIR /home/node | ||
|
||
ARG BUILD_ID | ||
ARG LAST_COMMIT_ID | ||
ENV BUILD_ID="${BUILD_ID}" | ||
ENV LAST_COMMIT_ID="${LAST_COMMIT_ID}" | ||
ENV PORT="${PORT:-3000}" | ||
ENV NODE_ENV="production" | ||
|
||
RUN apk update \ | ||
&& apk add ${BUILD_PACKAGES} \ | ||
&& mkdir -p /root \ | ||
&& mkdir -p /app \ | ||
&& $METEORD_DIR/build_app.sh \ | ||
&& apk del --purge ${BUILD_PACKAGES} \ | ||
&& $METEORD_DIR/clean-final.sh | ||
RUN mkdir -p /home/node/app | ||
COPY --chown=node --from=buildImg /home/node /home/node | ||
|
||
EXPOSE 3000 | ||
ENV BUILD_ID=${BUILD_ID} | ||
ENV LAST_COMMIT_ID=${LAST_COMMIT_ID} | ||
ENTRYPOINT sh $METEORD_DIR/run_app.sh | ||
EXPOSE "${PORT}" | ||
CMD ["node", "/home/node/app/main.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"TRAVIS_COMMIT": "${TRAVIS_COMMIT}", | ||
"TRAVIS_TAG": "${TRAVIS_TAG}", | ||
"GIT_REMOTE": "${GIT_REMOTE}" | ||
"GIT_REMOTE": "${GIT_REMOTE}", | ||
"NODE_USER_ID": "${NODE_USER_ID}", | ||
"NODE_GROUP_ID": "${NODE_GROUP_ID}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.