-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability for image to read env from a file by _FILE suffix #175
- Loading branch information
Showing
5 changed files
with
48 additions
and
14 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
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,10 +1,20 @@ | ||
FROM mhart/alpine-node:8.9.1 | ||
|
||
RUN apk update && apk upgrade && apk add git && apk add python && apk add make && apk add g++ && npm i -g yarn | ||
WORKDIR /usr/src/app | ||
COPY . . | ||
COPY custom-entrypoint.sh /usr/local/bin/custom-entrypoint.sh | ||
|
||
RUN chmod 755 /usr/local/bin/custom-entrypoint.sh && \ | ||
addgroup ico && \ | ||
adduser -D -H -G ico ico && \ | ||
apk add --update --no-cache git python make g++ && \ | ||
npm i -g yarn && \ | ||
yarn install | ||
|
||
VOLUME /usr/src/app | ||
EXPOSE 3000 | ||
EXPOSE 4000 | ||
WORKDIR /usr/src/app | ||
|
||
USER ico | ||
|
||
ENTRYPOINT ["/usr/local/bin/custom-entrypoint.sh"] | ||
CMD ["npm", "start"] |
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,17 +1,27 @@ | ||
FROM mhart/alpine-node:8.6 | ||
|
||
RUN mkdir -p /usr/src/app | ||
ADD . /usr/src/app | ||
|
||
WORKDIR /usr/src/app | ||
|
||
RUN mkdir -p /usr/src/app/dist | ||
RUN cp -r src/certs dist/ | ||
COPY . . | ||
COPY custom-entrypoint.sh /usr/local/bin/custom-entrypoint.sh | ||
|
||
RUN chmod 755 /usr/local/bin/custom-entrypoint.sh && \ | ||
addgroup ico && \ | ||
adduser -D -H -G ico ico && \ | ||
mkdir -p /usr/src/app/dist && \ | ||
cp -r src/certs dist/ | ||
RUN apk add --update --no-cache git python make g++ && \ | ||
npm i -g yarn && \ | ||
yarn install && \ | ||
yarn run build && \ | ||
yarn install --prod && \ | ||
apk del --purge git python make g++ && \ | ||
rm -rf ./src | ||
|
||
CMD npm run serve | ||
EXPOSE 3000 | ||
EXPOSE 4000 | ||
|
||
USER ico | ||
|
||
ENTRYPOINT ["/usr/local/bin/custom-entrypoint.sh"] | ||
CMD ["npm", "run", "serve"] |
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,14 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
for env in $(env); do | ||
key=${env%=*} | ||
[ -n "${key#*_FILE}" ] && continue | ||
val=${env#*=} | ||
key=${key%_FILE} | ||
val=$(cat $val) | ||
export "${key}"="${val}" | ||
done | ||
|
||
exec "$@" |
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