-
Notifications
You must be signed in to change notification settings - Fork 4
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
chore: fe deployment #85
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,17 +2,23 @@ FROM node:16 | |
|
||
WORKDIR /app/ | ||
COPY react-web /app | ||
COPY ./docker-files/.env.local . | ||
RUN npm install | ||
#COPY ./docker-files/.env.local . | ||
RUN npm install --global serve | ||
|
||
#"homepage": "https://input-output-hk.github.io/dapps-certification/" | ||
RUN sed -i 's/https:\/\/input-output-hk.github.io\/dapps-certification/http:\/\/localhost:3000/g' package.json | ||
RUN sed -i 's/http:\/\/excuse.ro:9672/https:\/\/dapps-certification.scdev.aws.iohkdev.io/g' package.json | ||
#"proxy": "https://testing.dapps.iog.io/" | ||
RUN sed -i 's/https:\/\/testing.dapps.iog.io/http:\/\/localhost:3000/g' package.json | ||
RUN sed -i 's/http:\/\/localhost:3000/http:\/\/localhost:80/g' package.json | ||
|
||
RUN npm install | ||
RUN rm -rf ./.env | ||
#RUN rm ./.env.production | ||
|
||
RUN npm run build | ||
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. The |
||
|
||
COPY ./docker-files/start_web.sh . | ||
RUN chmod +x ./start_web.sh | ||
|
||
ENTRYPOINT [ "./start_web.sh" ] | ||
#ENTRYPOINT [ "/bin/sh","-c","./start_web.sh"] | ||
CMD [ "npm","start" ] | ||
#CMD [ "npm","start" ] | ||
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. The 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. @RSoulatIOHK Sure, I'd be happy to explain further. In a Dockerfile, the The
In your Dockerfile, you have commented out the However, if the To ensure that your application runs when the Docker container starts, you should either:
I hope this clarifies things. Let me know if you have any other questions! 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. @CodeRabbit |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
REACT_APP_BASE_URL=http://lix:80 \ | ||
nix run .#web.runDockerImage |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#!/bin/bash | ||
#REACT_APP_BASE_URL="http://localhost:9671" | ||
echo $REACT_APP_BASE_URL | ||
npm start | ||
serve -s build | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
REACT_APP_BASE_URL="https://testing.dapps.iog.io/" | ||
REACT_APP_WALLET_NETWORK="1" | ||
REACT_APP_BASE_URL="https:\\dapps-certification.scdev.aws.iohkdev.io" | ||
REACT_APP_WALLET_NETWORK="1" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ pkgs,flake, ... }: let | ||
pkgsLinux = pkgs // { system = "x86_64-linux"; }; | ||
imgAttributes = { | ||
name = "plutus-certification-web"; | ||
tag = "5"; | ||
}; | ||
loadDockerImage = { | ||
type= "app"; | ||
program = (pkgs.writeShellScript "loadDockerImage" '' | ||
set -eEuo pipefail | ||
# build ./Dockerfile.web image and load it into docker | ||
${pkgs.docker}/bin/docker build -t ${imgAttributes.name}:${imgAttributes.tag} -f ./Dockerfile.web . | ||
#${pkgs.docker}/bin/docker save ${imgAttributes.name}:${imgAttributes.tag} | ${pkgs.docker}/bin/docker load | ||
#and now load the image into docker | ||
#${pkgs.docker}/bin/docker image ls | ||
'').outPath; | ||
Comment on lines
+12
to
+16
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. The command to save and load the Docker image is commented out. If this is intentional, consider removing these lines to avoid confusion. - #${pkgs.docker}/bin/docker save ${imgAttributes.name}:${imgAttributes.tag} | ${pkgs.docker}/bin/docker load
- #and now load the image into docker
- #${pkgs.docker}/bin/docker image ls |
||
}; | ||
in { | ||
loadDockerImage = loadDockerImage; | ||
runDockerImage = | ||
let addEnvVar = varName: '' | ||
if [ -n "${"$"}${varName}" ]; then | ||
docker_args="$docker_args -e ${varName}=${"$"}${varName}" | ||
fi | ||
''; | ||
in { | ||
type = "app"; | ||
program = (pkgs.writeShellScript "runDockerImage" '' | ||
set -eEo pipefail | ||
export PATH="${pkgs.lib.makeBinPath [ pkgs.docker pkgs.coreutils]}" | ||
echo "Executing ${loadDockerImage.program}..." >&2 | ||
${loadDockerImage.program} | ||
docker_args="-t --name ${imgAttributes.name} -p 80:3000" | ||
|
||
${addEnvVar "REACT_APP_BASE_URL"} | ||
|
||
script="docker run --rm $docker_args ${imgAttributes.name}:${imgAttributes.tag}" | ||
echo $script >&2 | ||
eval "$script" | ||
'').outPath; | ||
}; | ||
pushDockerImage = { | ||
type = "app"; | ||
#usage: nix run .\#apps.x86_64-linux.pushDockerImage -- <docker registry> | ||
#E.g. nix run .\#apps.x86_64-linux.pushDockerImage -- ghcr.io/demoiog | ||
program = (pkgs.writeShellScript "pushDockerImage" '' | ||
set -eEuo pipefail | ||
export PATH="${pkgs.lib.makeBinPath [ pkgs.docker pkgs.coreutils]}" | ||
${loadDockerImage.program} | ||
echo "Pushing docker image ${imgAttributes:name}:${imgAttributes.tag}" >&2 | ||
imageName="${imgAttributes.name}:${imgAttributes.tag}" | ||
|
||
script="docker image tag $imageName $1/$imageName" | ||
echo $script >&2 | ||
eval "$script" | ||
|
||
script="docker push $1/$imageName" | ||
echo $script >&2 | ||
eval "$script" | ||
|
||
'').outPath; | ||
}; | ||
} |
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.
CodeRabbit
The
serve
package is being installed globally. This package is typically used to serve static files. If the application relies on other packages that were previously installed withnpm install
, those packages may not be available anymore. Please ensure that all necessary dependencies are still being installed.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.
not bad 😄