diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 565c80416985f9ab346c1ae3b34d6a45fd94693b..fec3407cd2df91d85dbf45c73bee6b362e80a3a0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,28 +10,52 @@ stages:
   - build
   - deploy
 
-build:
+
+.build:
   stage: build
+  image: docker:24
+  variables:
+    CONTEXT: "."
   before_script:
-    - npm ci
-  script:
-    - NUXT_APP_BASE_URL=/wiki/ npm run generate
-  artifacts:
-    paths:
-      - .output/public
-    untracked: false
-    when: on_success
-    expire_in: "30 days"
-
-pages:
-  stage: deploy
-  only:
-    - main
+    - i=0; while [ "$i" -lt 12 ]; do docker info && break; sleep 5; i=$(( i + 1 )) ; done
+    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
   script:
-    - NUXT_APP_BASE_URL=/wiki npm run generate
-    - rm -rf public
-    - mv .output/public public
-  artifacts:
-    paths:
-      # The folder that contains the files to be exposed at the Page URL
-      - public
+    - docker build --pull -t "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA" --build-arg="BUILD_OPTIONS=$OPTIONS" -f $DOCKERFILE $CONTEXT
+    - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA"
+
+
+# build:
+#   stage: build
+#   before_script:
+#     - npm ci
+#   script:
+#     - NUXT_APP_BASE_URL=/wiki/ npm run generate
+#   artifacts:
+#     paths:
+#       - .output/public
+#     untracked: false
+#     when: on_success
+#     expire_in: "30 days"
+
+
+build:dev:nuxt:
+  extends: .build-nuxt
+  variables:
+    DOCKERFILE: "Dockerfile"
+    IMAGE_NAME: "df-wiki"
+    CONTEXT: "./"
+  rules:
+    - if: $CI_COMMIT_BRANCH != "main"
+
+# pages:
+#   stage: deploy
+#   only:
+#     - main
+#   script:
+#     - NUXT_APP_BASE_URL=/wiki npm run generate
+#     - rm -rf public
+#     - mv .output/public public
+#   artifacts:
+#     paths:
+#       # The folder that contains the files to be exposed at the Page URL
+#       - public
diff --git a/Dockerfile b/Dockerfile
index fcb53f47763a19bd301af3af7b845c91062d0ada..7368389b368fea36d865f958e881c63dc55c693c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,6 @@
 ### Stage Install ###
 FROM node:19.5-bullseye-slim as install
 
-RUN mkdir /usr/src/app
 WORKDIR /usr/src/app
 ENV PATH /usr/src/app/node_modules/.bin:$PATH
 COPY package*.json ./
@@ -22,13 +21,32 @@ CMD ["npm", "run", "dev"]
 ### STAGE: Build ###
 FROM node:19.5-bullseye-slim as build
 
+WORKDIR /usr/src/app
+COPY --from=install /usr/src/app ./
+COPY . /usr/src/app
+RUN npm run build
+
+### STAGE: serve ###
+FROM node:19.5-bullseye-slim as serve
+
+WORKDIR /usr/src/app
+COPY --from=build /usr/src/app/.output ./
+
+RUN ls -al ./
+
+CMD [ "node", "server/index.mjs"]
+
+
+### STAGE: Generate ###
+FROM node:19.5-bullseye-slim as generate
+
 WORKDIR /usr/src/app
 COPY --from=install /usr/src/app ./
 COPY . /usr/src/app
 RUN npm run generate
 
 ### STAGE: NGINX ###
-FROM nginx:stable-alpine
-COPY --from=build /usr/src/app/dist /usr/share/nginx/html
-EXPOSE 80
+FROM nginxinc/nginx-unprivileged:1.25
+# RUN rm -rf /usr/share/nginx/html/*
+COPY --from=generate /usr/src/app/.output/public /usr/share/nginx/html
 CMD ["nginx", "-g", "daemon off;"]
\ No newline at end of file