diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9ed0d7f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.git +__pycache__ +.gitignore +Dockerfile +README.md +images_md +node_modules +dist \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1043bd8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM node:19 + +ARG USERNAME=app +ARG USER_UID=1001 +ARG USER_GID=1001 + +WORKDIR /app +COPY ./ ./ +RUN rm ./src/config/config.js && mv ./src/config/config_docker.js ./src/config/config.js +RUN npm install +RUN npm run build + +# Create the user +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME +RUN chown -R $USER_UID:$USER_GID /app + +EXPOSE 44444 +USER app +CMD ["npm","run","start"] diff --git a/config/config_docker.js b/config/config_docker.js new file mode 100644 index 0000000..58bbf0b --- /dev/null +++ b/config/config_docker.js @@ -0,0 +1,11 @@ +export default { + server_port:44444, + local_features_microservice_url:"http://local_features_web:33333", + global_features_microservice_url:"http://global_features_web:33334", + color_microservice_url:"http://color_web:33335", + phash_microservice_url:"http://phash_web:33336", + image_text_features_microservice_url: "http://image_text_features_web:33338", + text_microservice_url:"http://text_web:33339", + image_caption_microservice_url: "http://image_caption_web:33340", + image_tags_microservice_url: "http://image_tags_web:33341", +} \ No newline at end of file diff --git a/server/index.ts b/server/index.ts index 265cc47..a6b659d 100644 --- a/server/index.ts +++ b/server/index.ts @@ -148,7 +148,7 @@ server.post("/get_image_caption", (_req, res) => { }) //////////////////////////////////////////////////////////////////////////////////////////////////////////// -server.listen({port:port, host:"127.0.0.1"}, function (err, address) { +server.listen({port:port, host:"0.0.0.0"}, function (err, address) { if (err) { console.error(err) process.exit(1)