-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
272c6c0
commit 426953f
Showing
4 changed files
with
53 additions
and
1 deletion.
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 @@ | ||
node_modules |
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,26 @@ | ||
name: Docker Build and Run React App | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-run: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build Docker image | ||
run: docker build -t developerstar:latest . | ||
|
||
- name: Run Docker container | ||
run: docker run -d -p 3000:5173 developerstar:latest |
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,25 @@ | ||
# base docker image for our deployment | ||
FROM node:20-alpine | ||
|
||
# we define the working directory | ||
WORKDIR /app | ||
|
||
# copy selected files to WorkDir | ||
COPY package*.json . | ||
|
||
# suppose if we're working with Typescript, then we can also: COPY tsconfig.json | ||
|
||
# installing all the required node packages | ||
RUN npm install | ||
|
||
# copying from source to destination | ||
# since we didn't wanted node_modules to be copies, so we added it in .dockerignore file | ||
COPY . . | ||
|
||
# exposing the port on which we were running | ||
EXPOSE 5173 | ||
|
||
# running our command | ||
CMD [ "npm", "run", "dev" ] | ||
|
||
# in the 'dev' script in package.json add '--host 0.0.0.0', so that it can run from any IP-Address |
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