diff --git a/README.md b/README.md index dba942bf3..3ad469c9a 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,20 @@ In order to run a container on port 3000: docker run -p 3000:80 [TAG] ``` +On top of that there are two possible scenarios for running docker image - using nginx server (default) of ipfs daemon. + +to run ipfs on port 3000: + +```bash +docker run -p 3000:80 [TAG] ipfs +``` + +to run nginx on port 3000: + +```bash +docker run -p 3000:80 [TAG] +``` + ## Build instructions The [`docker`](./docker) subfolder has some docker configurations for easily setting up your own hosted version of Console either for the web, or ready for pinning on IPFS. @@ -150,7 +164,7 @@ As a prerequisite you need to perform build of `dist` directory and move its con You can build any of the containers locally with the following command: ```bash -docker build --dockerfile docker/node-outside-docker.Dockerfile . --tag=[TAG] +docker build -f docker/node-outside-docker.Dockerfile . --tag=[TAG] ``` ### Verifying ipfs-hash of existing current application version diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 000000000..0bc9d09e0 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +daemon="${1:-nginx}" + +if [[ "$daemon" = "nginx" ]]; then + nginx -g 'daemon off;' +elif [[ "$daemon" = "ipfs" ]]; then + ipfs config profile apply server + ipfs config --json Addresses.Gateway '"/ip4/127.0.0.1/tcp/80"' + ipfs daemon +fi diff --git a/docker/node-inside-docker.Dockerfile b/docker/node-inside-docker.Dockerfile index d3baa154c..93b5fa4b2 100644 --- a/docker/node-inside-docker.Dockerfile +++ b/docker/node-inside-docker.Dockerfile @@ -20,6 +20,8 @@ RUN sh docker/docker-build.sh FROM --platform=amd64 nginx:1.23-alpine@sha256:6318314189b40e73145a48060bff4783a116c34cc7241532d0d94198fb2c9629 # configuration of system EXPOSE 80 +COPY docker/entrypoint.sh /entrypoint.sh +ENTRYPOINT [ "/entrypoint.sh" ] # Copy dist COPY docker/nginx.conf /etc/nginx/conf.d/default.conf RUN rm -rf /usr/share/nginx/html/* diff --git a/docker/node-outside-docker.Dockerfile b/docker/node-outside-docker.Dockerfile index e185fa8bc..d5aacba93 100644 --- a/docker/node-outside-docker.Dockerfile +++ b/docker/node-outside-docker.Dockerfile @@ -1,5 +1,7 @@ FROM --platform=amd64 nginx:1.23-alpine@sha256:6318314189b40e73145a48060bff4783a116c34cc7241532d0d94198fb2c9629 EXPOSE 80 +COPY docker/entrypoint.sh /entrypoint.sh +ENTRYPOINT [ "/entrypoint.sh" ] COPY docker/nginx.conf /etc/nginx/conf.d/default.conf RUN rm -rf /usr/share/nginx/html/* COPY ./dist-result/ /usr/share/nginx/html/