-
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
3 changed files
with
31 additions
and
10 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,10 +1,15 @@ | ||
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 | ||
ADD . . | ||
ADD custom-entrypoint.sh /usr/local/bin/custom-entrypoint.sh | ||
|
||
RUN chmod 755 /usr/local/bin/custom-entrypoint.sh && 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 | ||
|
||
|
||
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,21 @@ | ||
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/ | ||
ADD . . | ||
ADD custom-entrypoint.sh /usr/local/bin/custom-entrypoint.sh | ||
|
||
RUN chmod 755 /usr/local/bin/custom-entrypoint.sh && 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 | ||
|
||
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,12 @@ | ||
#!/bin/sh | ||
|
||
for env in $(env); do | ||
echo $env | grep '_FILE=' || continue | ||
key=${env%=*} | ||
val=${env#*=} | ||
key=${key%_FILE} | ||
val=$(cat $val) | ||
export "${key}"="${val}" | ||
done | ||
|
||
exec "$@" |