-
Notifications
You must be signed in to change notification settings - Fork 35
Dockerfile improvements #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
97e584a
Dockerfile improvements
qdm12 2e09a27
Add shell entrypoint to run sed command
qdm12 6ca4634
Add files to .dockerignore
qdm12 1985cab
Docker suggestions (#1)
Woodham e6ef911
Add EXPOSE
qdm12 d58b607
Remove comments and add new lines between stages
qdm12 3a40d1d
Remove publicDir variable
qdm12 6eca396
Change Dockerfile expose from 8000 to 8080
qdm12 103899b
Add documentation
qdm12 4421ebb
Remove port 8080 from EXPOSE and readme
qdm12 ec851b4
Clear up readme
qdm12 e19c7fd
Change websocket host to localhost in readme
qdm12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,3 +1,6 @@ | ||
| .git | ||
| .dockerignore | ||
| .gitignore | ||
| Dockerfile | ||
| README.md | ||
| LICENSE |
This file contains hidden or 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,15 +1,19 @@ | ||
| # multistage - builder image | ||
| FROM node:alpine AS builder | ||
| ARG ALPINE_VERSION=3.12 | ||
| ARG NODE_VERSION=15 | ||
| ARG NGINX_VERSION=1.19.6 | ||
|
|
||
| FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS builder | ||
| WORKDIR /app/Lightspeed-react | ||
| COPY . . | ||
| COPY package.json package-lock.json ./ | ||
| RUN npm install | ||
|
|
||
| # configure ip, hardcoded to webrtc container address (8080) for now | ||
| RUN sed -i "s|stream.gud.software|localhost|g" public/config.json | ||
|
|
||
| # build it | ||
| COPY . . | ||
| RUN npm run build | ||
|
|
||
| # runtime image | ||
| FROM nginx:stable | ||
| COPY --from=builder /app/Lightspeed-react/build /usr/share/nginx/html | ||
|
|
||
| FROM nginx:${NGINX_VERSION}-alpine | ||
| ENV WEBSOCKET_HOST=localhost | ||
| ENV WEBSOCKET_PORT=8080 | ||
| EXPOSE 80/tcp | ||
| COPY --chown=1000 docker/entrypoint.sh /docker-entrypoint.d/entrypoint.sh | ||
| COPY --chown=1000 docker/config.json.template /config.json.template | ||
| COPY --from=builder --chown=1000 /app/Lightspeed-react/build /usr/share/nginx/html | ||
qdm12 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -75,13 +75,40 @@ This is one of three components required for Project Lightspeed. Project Lightsp | |
|
|
||
| ## Getting Started | ||
|
|
||
| ## Setup | ||
|
|
||
| ### Docker | ||
|
|
||
| 1. Install [git](https://git-scm.com/downloads) | ||
| 1. Build the image from the master branch with: | ||
|
|
||
| ```sh | ||
| docker build -t grvydev/lightspeed-react https://github.com/GRVYDEV/Lightspeed-react.git | ||
| ``` | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that steps 1 and 2 will be removed once the image is built and pushed by the CI to Docker Hub |
||
|
|
||
| 1. Run it with | ||
|
|
||
| ```sh | ||
| docker run -it --rm \ | ||
| -p 8000:80/tcp \ | ||
| -e WEBSOCKET_HOST=localhost \ | ||
| -e WEBSOCKET_PORT=8080 \ | ||
| grvydev/lightspeed-react | ||
| ``` | ||
|
|
||
| Where your websocket host from the browser/client perspective is accessible on `localhost:8080`. | ||
|
|
||
| 1. You can now access it at [localhost:8000](http://localhost:8000). | ||
|
|
||
| ### Locally | ||
|
|
||
| To get a local copy up and running follow these simple steps. | ||
|
|
||
| ### Prerequisites | ||
| #### Prerequisites | ||
|
|
||
| In order to run this npm is required. Installation instructions can be found <a href="https://www.rust-lang.org/tools/https://www.npmjs.com/get-npm">here</a>. Npm Serve is required as well if you want to host this on your machine. That can be found <a href="https://www.npmjs.com/package/serve">here</a> | ||
|
|
||
| ### Installation | ||
| #### Installation | ||
|
|
||
| ```sh | ||
| git clone https://github.com/GRVYDEV/Lightspeed-react.git | ||
|
|
@@ -91,8 +118,10 @@ npm install | |
|
|
||
| <!-- USAGE EXAMPLES --> | ||
|
|
||
| ## Usage | ||
| #### Usage | ||
|
|
||
| First build the frontend | ||
|
|
||
| ```sh | ||
| cd Lightspeed-react | ||
| npm run build | ||
|
|
@@ -101,6 +130,7 @@ npm run build | |
| You should then configure the websocket URL in `config.json` in the `build` directory. | ||
|
|
||
| Now you can host the static site locally, by using `serve` for example | ||
|
|
||
| ```sh | ||
| serve -s build -l 80 | ||
| ``` | ||
|
|
||
This file contains hidden or 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,3 @@ | ||
| { | ||
| "wsUrl": "ws://${WEBSOCKET_HOST}:${WEBSOCKET_PORT}/websocket" | ||
| } |
This file contains hidden or 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,3 @@ | ||
| #!/bin/sh | ||
|
|
||
| envsubst < /config.json.template > "/usr/share/nginx/html/config.json" |
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.
Uh oh!
There was an error while loading. Please reload this page.