add docker

main
qwertyforce 2023-07-05 18:40:05 +03:00
parent 6ad6aaaa94
commit 5fe75471a8
4 changed files with 40 additions and 1 deletions

8
.dockerignore Normal file
View File

@ -0,0 +1,8 @@
.git
__pycache__
.gitignore
Dockerfile
README.md
images_md
node_modules
dist

20
Dockerfile Normal file
View File

@ -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"]

11
config/config_docker.js Normal file
View File

@ -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",
}

View File

@ -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)