diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000000000000000000000000000000000000..3c3629e647f5ddf82548912e337bea9826b434af
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1 @@
+node_modules
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 19f01a6f623af8497451f772f46ae4d82b111c4f..5a3389b73d501d0d6e6ba03408bc9993f1e1775f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,63 +1,84 @@
 stages:
-    - build
-    - deploy
+  - build
+  - deploy
+
+workflow:
+  rules:
+    # don't create a pipeline if its a commit pipeline, on a branch and that branch has open merge requests.
+    - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
+      when: never
+    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
+      variables:
+        DOCKER_IMAGE_TAG: "latest"
+    - if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
+      variables:
+        DOCKER_IMAGE_TAG: "$CI_COMMIT_REF_SLUG"
 
 build-esap-gui:
-    stage: build
-    image: node:lts
-    before_script:
-      - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
-    variables:
-      NODE_OPTIONS: "--openssl-legacy-provider"
-    script:
-      - node -v
-      - npm -version
-      - echo "Building deploy package"
-      - npm install
-      - CI= npm run build
-      - ls
-      - echo "Build successful"
-    artifacts:
-        expire_in: 1 hour
-        paths:
-            - build
+  stage: build
+  image: node:lts
+  before_script:
+    - "command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )"
+  variables:
+    NODE_OPTIONS: "--openssl-legacy-provider"
+  script:
+    - node -v
+    - npm -version
+    - echo "Building deploy package"
+    - npm install
+    - CI= npm run build
+    - ls
+    - echo "Build successful"
+  artifacts:
+    expire_in: 1 hour
+    paths:
+      - build
+
+build-esap-gui-docker:
+  stage: build
+  image: docker:stable
+  services:
+    - docker:dind
+  before_script:
+    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
+  script:
+    - docker build --pull -t "$CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG" .
+    - docker push "$CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG"
 
 deploy-esap-gui:
-    stage: deploy
-    before_script:
-      - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
-      - eval $(ssh-agent -s)
-      - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
-      - mkdir -p ~/.ssh
-      - chmod 700 ~/.ssh
-      - ssh-keyscan dop814.astron.nl >> ~/.ssh/known_hosts
-      - chmod 644 ~/.ssh/known_hosts
-    script:
-        - echo "Deploying to server"
-        - scp -O -r build/static/* sdc@dop814.astron.nl:~/shared/static
-        - scp -O -r build/* sdc@dop814.astron.nl:~/shared/public_html/esap-gui
-        - echo "Deployed"
-    when: manual
-    only:
-        - esap-gui-dev-xxx
-        - dev-nico-xxx
-        - master
+  stage: deploy
+  before_script:
+    - "command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )"
+    - eval $(ssh-agent -s)
+    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
+    - mkdir -p ~/.ssh
+    - chmod 700 ~/.ssh
+    - ssh-keyscan dop814.astron.nl >> ~/.ssh/known_hosts
+    - chmod 644 ~/.ssh/known_hosts
+  script:
+    - echo "Deploying to server"
+    - scp -O -r build/static/* sdc@dop814.astron.nl:~/shared/static
+    - scp -O -r build/* sdc@dop814.astron.nl:~/shared/public_html/esap-gui
+    - echo "Deployed"
+  when: manual
+  only:
+    - master
 
 deploy-esap-gui-acceptance:
-    stage: deploy
-    before_script:
-      - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
-      - eval $(ssh-agent -s)
-      - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
-      - mkdir -p ~/.ssh
-      - chmod 700 ~/.ssh
-      - ssh-keyscan dop457.astron.nl >> ~/.ssh/known_hosts
-      - chmod 644 ~/.ssh/known_hosts
-    script:
-        - echo "Deploying to server"
-        - scp -r build/static/* vermaas@dop457.astron.nl:/data/shared/static
-        - scp -r build/* vermaas@dop457.astron.nl:/data/shared/public_html/esap-gui
-        - echo "Deployed"
-    when: manual
-    only:
-        - acceptance
+  stage: deploy
+  before_script:
+    - "command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )"
+    - eval $(ssh-agent -s)
+    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
+    - mkdir -p ~/.ssh
+    - chmod 700 ~/.ssh
+    - ssh-keyscan dop457.astron.nl >> ~/.ssh/known_hosts
+    - chmod 644 ~/.ssh/known_hosts
+  script:
+    - echo "Deploying to server"
+    - scp -r build/static/* vermaas@dop457.astron.nl:/data/shared/static
+    - scp -r build/* vermaas@dop457.astron.nl:/data/shared/public_html/esap-gui
+    - echo "Deployed"
+  when: manual
+  only:
+    - acceptance
diff --git a/Dockerfile b/Dockerfile
index 0cd57293d4204b1553a092d32f887555f6b845a8..a7a7b57a78a90755675cb5a0ad7f23dd58278426 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,15 @@
-# production environment
-FROM nginx:latest
-COPY build /usr/share/nginx/html
+FROM node:lts as BUILD_STAGE
+
+RUN apt-get update && apt-get install -y git
+
+WORKDIR /app
+COPY package*.json ./
+RUN npm install
+
+COPY . .
+ENV NODE_OPTIONS="--openssl-legacy-provider"
+RUN CI= npm run build
+
+FROM nginx:mainline-alpine
+COPY --from=BUILD_STAGE /app/build /usr/share/nginx/html/esap-gui/
 EXPOSE 80
-CMD ["nginx", "-g", "daemon off;"]
\ No newline at end of file
diff --git a/package.json b/package.json
index 6fd0ca771b777f448d4646d530b939578404150c..e3eae98b412c93bab0cef5bf16d00d08b0cc4d17 100644
--- a/package.json
+++ b/package.json
@@ -42,5 +42,6 @@
       "last 1 firefox version",
       "last 1 safari version"
     ]
-  }
+  },
+  "homepage": "/esap-gui/"
 }
diff --git a/src/contexts/GlobalContext.js b/src/contexts/GlobalContext.js
index 3ccfbde271f95b574d82619c55c2f69a69a45faa..7cdc2a355ff92562b7daf59e031babc4f37d3fed 100644
--- a/src/contexts/GlobalContext.js
+++ b/src/contexts/GlobalContext.js
@@ -45,7 +45,7 @@ export function GlobalContextProvider({ children }) {
     const api_host =
     process.env.NODE_ENV === "development"
       ? "http://localhost:5555/esap-api/"
-      : "https://sdc-dev.astron.nl/esap-api/";
+      : "/esap-api/";
 
     const [archives, setArchives] = useState([]);
     const [datasets, setDatasets] = useState([]);