diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..347762c4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,24 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/charts +**/docker-compose* +**/compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..3d4ab898 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM node:20.0.0 +ENV NODE_ENV=production +WORKDIR /usr/src/app +# COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"] +# RUN npm install -g yarn + +COPY . . + +ENV YARN_VERSION 4.0.0 +RUN yarn policies set-version $YARN_VERSION + +RUN corepack enable yarn +RUN yarn install +# COPY . . + +RUN yarn build:all + +EXPOSE 3000 +EXPOSE 4000 + +RUN chown -R node /usr/src/app +USER node +CMD ["yarn", "start:all"] \ No newline at end of file diff --git a/docker-compose.debug.yml b/docker-compose.debug.yml new file mode 100644 index 00000000..115ef730 --- /dev/null +++ b/docker-compose.debug.yml @@ -0,0 +1,20 @@ +version: '3.4' + +services: + user-managed-access: + image: css-uma-main + build: + context: . + dockerfile: ./Dockerfile + environment: + NODE_ENV: development + ports: + - 3000:3000 + - 4000:4000 + - 4444:4444 + - 5123:5123 + - 8201:8201 + - 8202:8202 + - 8203:8203 + - 9229:9229 + command: ["node", "--inspect=0.0.0.0:9229", "index.js"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..ac167065 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: '3.4' + +services: + user-managed-access: + image: css-uma-main + build: + context: . + dockerfile: ./Dockerfile + environment: + NODE_ENV: production + ports: + - 3000:3000 + - 4000:4000 \ No newline at end of file diff --git a/dockerize.sh b/dockerize.sh new file mode 100644 index 00000000..112b4f6f --- /dev/null +++ b/dockerize.sh @@ -0,0 +1,2 @@ +#!/bin/bash +docker image build --pull --file './Dockerfile' --tag 'css-uma-main:latest' --label 'com.microsoft.created-by=visual-studio-code' --network=host ./ \ No newline at end of file diff --git a/packages/uma/bin/main.ts b/packages/uma/bin/main.ts index 073b0a1c..64a45f79 100644 --- a/packages/uma/bin/main.ts +++ b/packages/uma/bin/main.ts @@ -5,7 +5,8 @@ import { setLogger } from '../src/util/logging/LoggerUtils'; import { WinstonLogger } from '../src/util/logging/WinstonLogger'; const protocol = 'http'; -const host = 'localhost'; +// const host = 'localhost'; // This gives problems with docker internal network +const host = '0.0.0.0'; const port = 4000; const baseUrl = `${protocol}://${host}:${port}/uma`;