parent
401c712ca4
commit
936d620b3b
@ -1,54 +1,48 @@
|
|||||||
# The Docker image that will be used to build your app
|
variables:
|
||||||
image: node:16.5.0
|
APP_NAME: postametes_front
|
||||||
pages:
|
IMAGE_NAME: $CI_REGISTRY_IMAGE
|
||||||
stage: deploy
|
|
||||||
cache:
|
stages:
|
||||||
key:
|
- build
|
||||||
files:
|
- deploy
|
||||||
- yarn.lock
|
|
||||||
prefix: yarn
|
|
||||||
paths:
|
|
||||||
- node_modules/
|
|
||||||
script:
|
|
||||||
- yarn
|
|
||||||
- yarn build
|
|
||||||
- cp -a dist/. public/
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
# The folder that contains the files to be exposed at the Page URL
|
|
||||||
- public
|
|
||||||
rules:
|
|
||||||
# This ensures that only pushes to the default branch will trigger
|
|
||||||
# a pages deploy
|
|
||||||
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|
|
||||||
|
|
||||||
build-remote:
|
.build: &build-common
|
||||||
stage: build
|
stage: build
|
||||||
only:
|
image: docker:20.10-dind
|
||||||
- sst_main
|
before_script:
|
||||||
|
- sudo docker login -u $CI_DEPLOY_USER -p $CI_DEPLOY_PASSWORD $CI_REGISTRY
|
||||||
script:
|
script:
|
||||||
- cd /home/toren332/sst_postamates/
|
- sudo docker pull $IMAGE_NAME:builder || true
|
||||||
- sudo git fetch
|
- sudo docker pull $IMAGE_NAME:$CI_COMMIT_SHORT_SHA || true
|
||||||
- sudo git reset --hard origin/sst_main
|
- sudo docker build --cache-from $IMAGE_NAME:builder --target builder --tag $IMAGE_NAME:builder .
|
||||||
- sudo git submodule foreach git pull origin sst_main
|
- sudo docker push $IMAGE_NAME:builder
|
||||||
- sudo git add postamates_frontend
|
- sudo docker build --cache-from $IMAGE_NAME:builder --cache-from $IMAGE_NAME:$CI_COMMIT_SHORT_SHA --tag $IMAGE_NAME:$IMAGE_TAG --build-arg REACT_APP_DOMAIN_URL=$REACT_APP_DOMAIN_URL --build-arg BUILDKIT_INLINE_CACHE=1 .
|
||||||
- sudo git commit -m "new frontend"
|
- sudo docker push $IMAGE_NAME:$IMAGE_TAG
|
||||||
- sudo git push
|
|
||||||
tags:
|
tags:
|
||||||
- deploy-remote
|
- deploy-remote
|
||||||
|
|
||||||
deploy-remote:
|
build-test-job:
|
||||||
|
<<: *build-common
|
||||||
|
variables:
|
||||||
|
IMAGE_TAG: $CI_COMMIT_SHORT_SHA
|
||||||
|
REACT_APP_DOMAIN_URL: https://$DOMAIN/
|
||||||
|
rules:
|
||||||
|
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "sst_main"
|
||||||
|
|
||||||
|
.deploy: &deploy-common
|
||||||
stage: deploy
|
stage: deploy
|
||||||
only:
|
before_script:
|
||||||
- sst_main
|
- sudo docker login -u $CI_DEPLOY_USER -p $CI_DEPLOY_PASSWORD $CI_REGISTRY
|
||||||
script:
|
script:
|
||||||
- cd /home/toren332/sst_postamates/
|
- sudo docker pull $IMAGE_NAME:$IMAGE_TAG
|
||||||
- sudo docker-compose down
|
- sudo docker-compose -f $COMPOSE up -d
|
||||||
- sudo git fetch
|
|
||||||
- sudo git reset --hard origin/sst_main
|
|
||||||
- sudo git submodule foreach git pull origin sst_main
|
|
||||||
- sudo docker-compose build --no-cache frontend
|
|
||||||
- sudo docker-compose up -d
|
|
||||||
tags:
|
tags:
|
||||||
- deploy-remote
|
- deploy-remote
|
||||||
|
|
||||||
|
deploy-test-job:
|
||||||
|
<<: *deploy-common
|
||||||
|
variables:
|
||||||
|
COMPOSE: docker-compose.yml
|
||||||
|
IMAGE_TAG: $CI_COMMIT_SHORT_SHA
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_BRANCH == "sst_main"
|
||||||
|
|||||||
@ -0,0 +1,12 @@
|
|||||||
|
version: "3.9"
|
||||||
|
|
||||||
|
services:
|
||||||
|
front:
|
||||||
|
image: ${IMAGE_NAME}:${IMAGE_TAG}
|
||||||
|
container_name: ${APP_NAME}
|
||||||
|
ports:
|
||||||
|
- "3002:80"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
default:
|
||||||
|
name: postamates_network
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 8000;
|
||||||
|
multi_accept on;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80 default ipv6only=on;
|
||||||
|
|
||||||
|
charset UTF-8;
|
||||||
|
client_max_body_size 200M;
|
||||||
|
|
||||||
|
root /opt/site;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in new issue