diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..b1dd1d823 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +**/node_modules +node_modules +.idea/ +.vscode/ \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..19122009a --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,12 @@ +--- +include: + - project: 'kits-maxiv/cfg-maxiv-gitlabci' + file: '/Docker.gitlab-ci.yml' + +variables: + IMAGE_NAME: $CI_PROJECT_NAME + DOCKERFILE: "./Dockerfile" + DOCKER_REGISTRY_LOGIN: $HARBOR_IMS_ROBOT_USER + DOCKER_REGISTRY_PASSWORD: $HARBOR_IMS_ROBOT_PASS + MAJOR_TAG: $CI_COMMIT_TAG + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..5254e0f91 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +FROM harbor.maxiv.lu.se/dockerhub/library/node:18-bullseye-slim as build-step + +#RUN apk --no-cache add curl +RUN apt-get -y update; apt-get -y install curl + +# set working directory +#RUN mkdir /usr/app +WORKDIR /usr/app +#COPY ./public /usr/app/public +#COPY ./src /usr/app/src +COPY ./ /usr/app/ + +ARG NODE_ENV=development +ENV NODE_ENV=${NODE_ENV} + +# install and cache app dependencies +#COPY package.json /usr/app/package.json +#COPY package-lock.json /usr/app/package-lock.json +RUN npm install -g npm +RUN npm install + +# add `/usr/src/app/node_modules/.bin` to $PATH +ENV PATH /usr/app/node_modules/.bin:$PATH + +ENV REACT_APP_ISPYB_ENV MAXIV +EXPOSE 3000 +CMD ["npm", "start"] + + +#RUN npm run build --max-old-space-size=4096 +# +# Deploy container. +#FROM docker.io/nginxinc/nginx-unprivileged:1-alpine +# +#COPY docker/config/default.conf /etc/nginx/conf.d/ +# +#COPY --from=build-step /usr/app/build/ /usr/share/nginx/html/ + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100755 index 000000000..bfb0d5921 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,27 @@ +version: "3.6" +networks: + traefik-network: + external: true + +services: + py-ispyb-ui: + build: + args: + - NODE_ENV=development + context: . + environment: + - NODE_ENV=development + container_name: py-ispyb-ui + labels: + - "traefik.backend=py-ispyb-ui-localhost" + - "traefik.frontend.rule=Host:py-ispyb-ui.localhost" + - "traefik.docker.network=traefik-network" + - "traefik.port=3000" + volumes: + - ./src:/usr/app/src + - ./public:/usr/app/public + networks: + - traefik-network + ports: + - 5000:5000 + diff --git a/docker/config/default.conf b/docker/config/default.conf new file mode 100644 index 000000000..441cdc2e3 --- /dev/null +++ b/docker/config/default.conf @@ -0,0 +1,22 @@ +server { + listen 8080; + server_name localhost; + + real_ip_header X-Forwarded-For; + + set_real_ip_from 0.0.0.0/0; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + + try_files $uri $uri/ /index.html; + } + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7d07cd261..5cb2bc31e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40429,4 +40429,4 @@ } } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 3861d1adc..4bd42a928 100644 --- a/package.json +++ b/package.json @@ -138,4 +138,4 @@ "last 1 safari version" ] } -} +} \ No newline at end of file diff --git a/src/components/Auth/Login/LoginJava.tsx b/src/components/Auth/Login/LoginJava.tsx index 778a721ee..fbebeb2d1 100644 --- a/src/components/Auth/Login/LoginJava.tsx +++ b/src/components/Auth/Login/LoginJava.tsx @@ -96,7 +96,7 @@ export default function LoginJava() { )}