Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(back): Adjust the folder structure for backend container, etc.
We did: * Add Dockerfile in `back/` folder for docker container `backend`. Now it will build the node_modules in image. It will be helpful for those who do not have tool yarn and reduce the difficulty of running. * Move source files from `back/` to `back/src`. Because Dockerfile's `COPY` cannot just copy directory. [More info][github-moby-dockerfile-stupid-copy]. And that's why we also change some files with new path to those source files. * Add `depends_on` keys in `docker-compose.yml` [github-moby-dockerfile-stupid-copy]: moby/moby#15858
- Loading branch information
1 parent
9bca275
commit 9e0dda5
Showing
12 changed files
with
24 additions
and
12 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM node | ||
|
||
WORKDIR /home/node/app/ | ||
|
||
COPY package.json yarn.lock ./ | ||
RUN yarn && mkdir src | ||
COPY ./src/ ./src/ | ||
|
||
USER node | ||
EXPOSE 4000 | ||
|
||
CMD ["yarn", "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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
|
@@ -34,3 +34,4 @@ GraphQLServer.use( | |
GraphQLServer.listen(4000, () => { | ||
console.log('Listening on localhost:4000...'); | ||
}); | ||
|
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,19 +1,17 @@ | ||
version: "3" | ||
services: | ||
db: | ||
build: ./back/db/ | ||
build: ./back/src/db/ | ||
backend: | ||
image: node | ||
user: node | ||
working_dir: /home/node/app/ | ||
environment: | ||
- NODE_ENV=production | ||
volumes: | ||
- ./back/:/home/node/app/ | ||
command: "node main.js" | ||
build: ./back/ | ||
depends_on: | ||
- db | ||
nginx: | ||
build: ./server/ | ||
ports: | ||
- 80:80 | ||
volumes: | ||
- ./front/dist/:/usr/share/nginx/html/ | ||
depends_on: | ||
- db | ||
- backend |