This repository has been archived by the owner on Apr 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 131
Docker env #74
Merged
Merged
Docker env #74
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d4b0581
Added docker file
2at2 3310c9f
Added docker env
2at2 eed62c8
Added docker env
2at2 b574a81
Renamed tool -> trust
2at2 cad5ecf
Merge remote-tracking branch 'origin/master' into docker-env
2at2 0e9496a
Merge remote-tracking branch 'origin/master' into docker-env
2at2 8c5020e
added .env
2at2 7b650bd
fix .gitignore
2at2 343b3aa
Merge remote-tracking branch 'origin/master' into docker-env
2at2 301c6d2
fix .gitignore
2at2 a6d7efa
fix .env
2at2 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 |
---|---|---|
|
@@ -18,3 +18,5 @@ $ Ignore the .env file for the server | |
*.log | ||
|
||
dist | ||
|
||
docker/data/ |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: '3.1' | ||
|
||
services: | ||
|
||
app: | ||
volumes: | ||
- ./:/opt/server | ||
ports: | ||
- 8000:8000 | ||
|
||
mongodb: | ||
volumes: | ||
- ./docker/data/mongodb:/data/db | ||
ports: | ||
- 27017:27017 |
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 @@ | ||
version: '3.1' | ||
|
||
services: | ||
|
||
app: | ||
build: ./docker | ||
env_file: .env | ||
links: | ||
- mongodb | ||
|
||
mongodb: | ||
image: mongo:latest | ||
environment: | ||
- MONGO_DATA_DIR=/data/db |
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,7 @@ | ||
FROM node:6.12.1 | ||
|
||
COPY ./entrypoints /entrypoints | ||
|
||
WORKDIR /opt/server | ||
|
||
CMD /entrypoints/run |
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,4 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
build() { | ||
echo "Building..." | ||
|
||
docker-compose pull | ||
docker-compose build | ||
|
||
_in_docker app npm install | ||
_in_docker app npm run build | ||
|
||
if [ "$?" -ne 0 ]; then | ||
echo "Failed build" | ||
else | ||
echo "Build OK" | ||
fi | ||
} | ||
|
||
run() { | ||
docker-compose up -d --remove-orphans $* | ||
} | ||
|
||
stop() { | ||
docker-compose stop $* | ||
} | ||
|
||
logs() { | ||
docker-compose logs -f app | ||
} | ||
|
||
_in_docker() { | ||
service="$1" | ||
cmd="${@:2}" | ||
|
||
docker-compose run --rm --no-deps $service bash -c "sleep 0.1; $cmd" | ||
} | ||
|
||
help() { | ||
echo -e "build Build npm modules" | ||
echo -e "run Run docker containers" | ||
echo -e "stop Stop docker containers" | ||
echo -e "logs App logs" | ||
} | ||
|
||
main() { | ||
declare cmd="$1" | ||
|
||
case "$cmd" in | ||
run) shift; run "$@";; | ||
stop) shift; stop "$@";; | ||
build) shift; build;; | ||
logs) shift; logs;; | ||
*) help "$@";; | ||
esac | ||
} | ||
|
||
main "$@" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to mount volumes and expose ports - yes.
You can export COMPOSE_FILE in your terminal before using ./trust build and ./trust run.