There is no result after auto-deploy an app using GitLab CI/CD on Ubuntu

163 Views Asked by At

In my laptop with npm run serve can load my Vue app on http://localhost:8080 so i initialized git and push the app into a new Gitlab repository then created Dockerfile as below:

FROM node:12.18.3 AS build-stage
WORKDIR /app
COPY package*.json .
RUN npm install
COPY . .
RUN npm run build

FROM php:7.3-apache AS production-stage
COPY --from=build-stage /app/dist /var/www/html
EXPOSE 80
CMD ["apachectl", "-D", "FOREGROUND"]

I built an image docker build -t vue-app . and run it in my laptop by docker run -d -p 80:80 --rm --name test-vue-app vue-app that works well

So to use Gitlab CICD to deploy this app on my self-hosted Ubuntu as a home server created followed .gitlab-ci.yml

image: docker
services:
  - docker:dind
stages:
  - deploy
step-deploy-prod:
  stage: deploy
  script:
    - docker build -t vue-app .
    - docker run -d -p 80:80 --rm --name testvueapp vue-app

also in another pc as server (with the fresh Ubuntu os), installed ufw, open-ssh, apache2 and php and set my Router up to check this pc worked well as a simple home server which was positive

So connected to server device with ssh and install and register gitlab-runner and Docker as well.

Although with running Gitlab Pipeline can get Job succeeded, couldn't see any changes or update in server and load the result of running container even directly in server machine

PS: by enabling apache2 on server device, i can load a simple php page on http://XX.XX.XX.XX (according to exist /var/www/html/index.php file) from any device but after running pipeline it doesn't work and if apache2 be enabled on server only can load php page instead Vue app

0

There are 0 best solutions below