diff --git a/docker/README.md b/docker/README.md index f0701f0da..9743e7baf 100644 --- a/docker/README.md +++ b/docker/README.md @@ -4,15 +4,16 @@ # cd root of the project # build postgres image -docker buildx build -t mega-db:0.1-pre-release -f ./docker/mega_pg_dockerfile . +docker buildx build -t mono-pg:0.1-pre-release -f ./docker/mono-pg-dockerfile . # build backend mono image (default in release mode) -docker buildx build -t mega-mono:0.1-pre-release -f ./docker/mega_mono_dockerfile . +docker buildx build -t mono-engine:0.1-pre-release -f ./docker/mono-engine-dockerfile . + # build backend mono in debug mode -# docker buildx build -t mega-mono:1.0 -f ./docker/mega_mono_dockerfile --build-arg BUILD_TYPE=debug . +# docker buildx build -t mono-engine:0.1-pre-debug -f ./docker/mono-engine-dockerfile --build-arg BUILD_TYPE=debug . # build frontend moon image -docker buildx build -t mega-moon:0.1-pre-release -f ./docker/mega_moon_dockerfile . +docker buildx build -t mono-ui:0.1-pre-release -f ./docker/moon-ui-dockerfile . ``` ## Test mono and moon @@ -22,10 +23,10 @@ docker buildx build -t mega-moon:0.1-pre-release -f ./docker/mega_moon_dockerfil ```bash # create network -docker network create mega-network +docker network create mono-network -docker run --rm -it -d --network mega-network --name mega-mono -v ./mega_base:/opt/mega mega-mono:0.1-pre-release -docker run --rm -it -d --network mega-network -e NEXT_PUBLIC_API_URL=http://mega-mono:8000 -p 3000:3000 mega-moon:0.1-pre-release +docker run --rm -it -d --network mono-network --name mono-engine mono-engine:0.1-pre-release +docker run --rm -it -d --network mono-network -e NEXT_PUBLIC_API_URL=http://mono-engine:8000 -p 3000:3000 mono-ui:0.1-pre-release ``` visit http://localhost:3000 to see the frontend @@ -45,7 +46,7 @@ docker run --rm -it -d --network mega-network --name mega-db mega-db:0.1-pre-rel [2] create default config ```bash -docker run --rm -it -d --network mega-network --name mega-mono -v ./mega_base:/opt/mega mega-mono:0.1-pre-release +docker run --rm -it -d --network mega-network --name mega-mono -v ./mega_base:/opt/mega/etc mega-mono:0.1-pre-release docker stop mega-mono ``` @@ -65,6 +66,6 @@ db_url = "postgres://mega:mega@mega-db:5432/mega" [4] Start the mono again, and run the frontend. ```bash -docker run --rm -it -d --network mega-network --name mega-mono -v ./mega_base:/opt/mega mega-mono:0.1-pre-release +docker run --rm -it -d --network mega-network --name mega-mono -v ./mega_base:/opt/mega/etc mega-mono:0.1-pre-release docker run --rm -it -d --network mega-network -e NEXT_PUBLIC_API_URL=http://mega-mono:8000 -p 3000:3000 mega-moon:0.1-pre-release ``` \ No newline at end of file diff --git a/docker/mega_mono_dockerfile b/docker/mono-engine-dockerfile similarity index 88% rename from docker/mega_mono_dockerfile rename to docker/mono-engine-dockerfile index 7e4f130ee..996e18e82 100644 --- a/docker/mega_mono_dockerfile +++ b/docker/mono-engine-dockerfile @@ -33,7 +33,7 @@ RUN apt-get update && apt-get install -y \ && curl https://sh.rustup.rs -sSf | sh -s -- -y \ && . $HOME/.cargo/env -ENV PATH=/root/.cargo/bin:$PATH! +ENV PATH=/root/.cargo/bin:$PATH # copy the source code, the context must be the root of the project COPY . . @@ -53,10 +53,10 @@ RUN apt-get update && apt-get install -y libssl-dev ARG BUILD_TYPE=release COPY --from=builder /opt/mega/target/$BUILD_TYPE/mono /usr/local/bin/mono -COPY --from=builder /opt/mega/docker/start_mono.sh /usr/local/bin/start_mono.sh -RUN chmod +x /usr/local/bin/start_mono.sh +COPY --from=builder /opt/mega/docker/start-mono.sh /usr/local/bin/start-mono.sh +RUN chmod +x /usr/local/bin/start-mono.sh RUN chmod +x /usr/local/bin/mono VOLUME /opt/mega -CMD ["bash", "-c", "/usr/local/bin/start_mono.sh"] \ No newline at end of file +CMD ["bash", "-c", "/usr/local/bin/start-mono.sh"] \ No newline at end of file diff --git a/docker/mega_pg_dockerfile b/docker/mono-pg-dockerfile similarity index 100% rename from docker/mega_pg_dockerfile rename to docker/mono-pg-dockerfile diff --git a/docker/mega_moon_dockerfile b/docker/moon-ui-dockerfile similarity index 63% rename from docker/mega_moon_dockerfile rename to docker/moon-ui-dockerfile index 743dbb89f..e56bac5ef 100644 --- a/docker/mega_moon_dockerfile +++ b/docker/moon-ui-dockerfile @@ -13,10 +13,10 @@ COPY ./moon . RUN npm run build -COPY ./docker/start_moon.sh /app/start_moon.sh +COPY ./docker/start-moon.sh /app/start-moon.sh -RUN chmod +x /app/start_moon.sh +RUN chmod +x /app/start-moon.sh EXPOSE 3000 -ENTRYPOINT ["/bin/sh", "/app/start_moon.sh"] \ No newline at end of file +ENTRYPOINT ["/bin/sh", "/app/start-moon.sh"] \ No newline at end of file diff --git a/docker/start_mono.sh b/docker/start-mono.sh similarity index 72% rename from docker/start_mono.sh rename to docker/start-mono.sh index f5382c885..31ff233ad 100755 --- a/docker/start_mono.sh +++ b/docker/start-mono.sh @@ -6,7 +6,7 @@ CONFIG_FILE="$MEGA_BASE_DIR/etc/config.toml" # check if config file exists if [ -f "$CONFIG_FILE" ]; then echo "Using config file: $CONFIG_FILE" - exec /usr/local/bin/mono -c "$CONFIG_FILE" service multi --host 127.0.0.1 --ssh-port 22 + exec /usr/local/bin/mono -c "$CONFIG_FILE" service multi --host 0.0.0.0 --ssh-port 22 else - exec /usr/local/bin/mono service multi --host 127.0.0.1 --ssh-port 22 + exec /usr/local/bin/mono service multi --host 0.0.0.0 --ssh-port 22 fi \ No newline at end of file diff --git a/docker/start_moon.sh b/docker/start-moon.sh similarity index 100% rename from docker/start_moon.sh rename to docker/start-moon.sh