Skip to content

Commit

Permalink
Update action.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
SeoulSKY committed Mar 13, 2024
1 parent 9575653 commit 85a541c
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 61 deletions.
4 changes: 1 addition & 3 deletions build-protos.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash

PROTO_PATH=protos

SCRIPT_PATHS=("sorusora" "sorusora-ai")

EXEC=build-protos.sh
Expand All @@ -11,6 +9,6 @@ for path in "${SCRIPT_PATHS[@]}"; do

pushd "${path}" > /dev/null || return
chmod +x "${EXEC}"
./"${EXEC}" "../${PROTO_PATH}"
./"${EXEC}"
popd > /dev/null || return
done
4 changes: 2 additions & 2 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
sorusora:
build:
context: .
dockerfile: docker/sorusora/Dockerfile
dockerfile: sorusora/Dockerfile
container_name: sorusora
volumes:
- ./sorusora/logs:/app/logs
Expand All @@ -19,7 +19,7 @@ services:
sorusora-ai:
build:
context: .
dockerfile: docker/sorusora-ai/Dockerfile
dockerfile: sorusora-ai/Dockerfile
container_name: sorusora-ai
volumes:
- ./sorusora-ai/logs:/app/logs
Expand Down
40 changes: 0 additions & 40 deletions docker/sorusora-ai/Dockerfile

This file was deleted.

15 changes: 11 additions & 4 deletions sorusora-ai/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ SHELL ["/bin/bash", "-c"]

ENV NODE_VERSION=21.6

ENV ROOT_PATH ../../sorusora-ai
ENV ROOT_PATH sorusora-ai

ENV PROTO_PATH protos

RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \
&& export NVM_DIR="$HOME/.nvm" \
Expand All @@ -24,10 +26,15 @@ COPY ${ROOT_PATH}/package.json .

RUN npm install

COPY ${ROOT_PATH} .
COPY ${PROTO_PATH} ${PROTO_PATH}

COPY ${ROOT_PATH}/build-protos.sh .

RUN chmod +x build-protos.sh \
&& ./build-protos.sh \
&& npm run build
&& ./build-protos.sh ${PROTO_PATH}

COPY ${ROOT_PATH} .

RUN npm run build

CMD ["npm", "start"]
16 changes: 9 additions & 7 deletions sorusora-ai/build-protos.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/bash

if [[ $# -ne 1 ]]; then
echo "Usage: $0 <path-to-protos-dir>"
exit 1
if [[ $# -eq 1 ]]; then
PROTO_DIR=$1
else
PROTO_DIR=../protos
fi

PROTO_DIR=$1
OUT_DIR=src/protos

PATH=${PATH}:./node_modules/.bin
Expand All @@ -18,12 +20,12 @@ grpc_tools_node_protoc \
--js_out=import_style=commonjs,binary:"${OUT_DIR}" \
--grpc_out=grpc_js:"${OUT_DIR}" \
--plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin \
-I "$1" \
"$1"/*.proto
-I "${PROTO_DIR}" \
"${PROTO_DIR}"/*.proto

# Generate TypeScript code (d.ts) for gRPC
grpc_tools_node_protoc \
--plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \
--ts_out=grpc_js:"${OUT_DIR}" \
-I "$1" \
"$1"/*.proto
-I "${PROTO_DIR}" \
"${PROTO_DIR}"/*.proto
File renamed without changes.
11 changes: 6 additions & 5 deletions sorusora/build-protos.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash

if [[ $# -ne 1 ]]; then
echo "Usage: $0 <path-to-protos-dir>"
exit 1
if [[ $# -eq 1 ]]; then
PROTO_DIR=$1
else
PROTO_DIR=../protos
fi

OUT_DIR=protos
Expand All @@ -20,7 +21,7 @@ fi
${EXEC} pip install grpcio-tools

${EXEC} python -m grpc_tools.protoc \
-I "$1" \
-I "${PROTO_DIR}" \
--python_out="${OUT_DIR}" \
--grpc_python_out="${OUT_DIR}" \
"$1"/*.proto
"${PROTO_DIR}"/*.proto

0 comments on commit 85a541c

Please sign in to comment.