diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..6be8c8f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git +.dockerignore diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..b8b8f74 --- /dev/null +++ b/.env.production @@ -0,0 +1 @@ +VITE_API_URL=https://psp.dets.ch/api \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..b4c3ab9 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,53 @@ +stages: + - build + - deploy + +variables: + PY_COLORS: '1' + ANSIBLE_FORCE_COLOR: '1' + ANSIBLE_PYTHON_INTERPRETER: auto_silent + ANSIBLE_STDOUT_CALLBACK: debug + +docker-build-master: + # Official docker image. + image: docker:latest + stage: build + tags: + - docker + 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 push "$CI_REGISTRY_IMAGE" + only: + - master + +docker-build: + # Official docker image. + image: docker:latest + stage: build + tags: + - docker + 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:$CI_COMMIT_REF_SLUG" . + - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" + except: + - main + +deploy-master: + #when: manual + stage: deploy + image: + name: cytopia/ansible:latest-tools + entrypoint: [""] + script: + - chmod 600 "${ANSIBLE_SSH_KEY_PRIVATE}" + - ansible-playbook -i ./deployment/hosts.yml --private-key "${ANSIBLE_SSH_KEY_PRIVATE}" "./deployment/deployment.yml" + only: + - main diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ffa1114 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM node:alpine as build-stage +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +RUN npm run build + +# production stage +FROM nginx:stable-alpine as production-stage +COPY --from=build-stage /app/dist /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/README.md b/README.md index a797a27..191d092 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,4 @@ -# Vue 3 + Typescript + Vite +# Radiator-Web -This template should help get you started developing with Vue 3 and Typescript in Vite. +API URL must be set on Build Time, either via Env `API_URL`(prefered), or via `VITE_API_URL` from [`.env.production`](.env.production) -## Recommended IDE Setup - -[VSCode](https://code.visualstudio.com/) + [Vetur](https://marketplace.visualstudio.com/items?itemName=octref.vetur). Make sure to enable `vetur.experimental.templateInterpolationService` in settings! - -### If Using `