Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d0052ae
commit 4a7d9df
Showing
176 changed files
with
42,322 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#### Tạo image to deploy | ||
|
||
- cd vào Project muốn tạo docker image. | ||
\$ touch Dockerfile | ||
|
||
- Paste Config below | ||
|
||
``` | ||
FROM node:10.16.2 as builder-stage | ||
WORKDIR /app | ||
COPY ./package*.json ./ | ||
COPY . . | ||
RUN npm install | ||
RUN npm run build | ||
FROM nginx:latest as nginx-stage | ||
RUN rm /etc/nginx/conf.d/default.conf | ||
COPY nginx/default.conf /etc/nginx/conf.d | ||
EXPOSE 80 | ||
EXPOSE 443 | ||
COPY --from=builder-stage /app/build /usr/share/nginx/html | ||
CMD ["nginx", "-g", "daemon off;"] | ||
``` | ||
|
||
## Build image | ||
|
||
docker build --tag fwd.web.frontend:latest . | ||
|
||
## Build image to tar file | ||
|
||
docker save --output /Users/dboi/Desktop/docker-fwd-tapp-frontend.tar fwd.web.frontend:latest | ||
|
||
## Import image to docker | ||
|
||
docker load < docker-fwd-tapp-frontend.tar | ||
|
||
## Run Image with container | ||
|
||
docker run -d -p 80:80 --restart always --name fwd-frontend fwd.web.frontend:latest | ||
|
||
## Copy file to server | ||
|
||
scp -i ~/Desktop/tap-dev.pem ~/Desktop/docker-fwd-tapp-frontend.tar ubuntu@18.140.74.12:/home/ubuntu/fwdfrontent | ||
|
||
## remove images | ||
|
||
docker image prune |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM node:12.16.2 as builder-stage | ||
WORKDIR /app | ||
COPY ./package*.json ./ | ||
COPY . . | ||
RUN npm install | ||
RUN npm run build-dev | ||
|
||
FROM nginx:latest as nginx-stage | ||
RUN rm /etc/nginx/conf.d/default.conf | ||
COPY nginx/default.conf /etc/nginx/conf.d | ||
EXPOSE 80 | ||
EXPOSE 443 | ||
COPY --from=builder-stage /app/build /usr/share/nginx/html | ||
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Working on Jenskin Server | ||
|
||
## Go to folder to clone project | ||
|
||
cd /Users/vinova/Project | ||
|
||
## Clone source code | ||
|
||
git clone --single-branch --branch develop git@gitlab.com:vinova/fwd/fwd-tapp-web-frontend.git | ||
|
||
## Go to folder Project | ||
|
||
cd fwd-tapp-web-frontend | ||
|
||
## Build image with docker | ||
|
||
docker build --tag fwd.web.frontend:latest . | ||
|
||
## Export image to tar file | ||
|
||
docker save --output /Users/vinova/Docker/docker-fwd-tapp-frontend.tar fwd.web.frontend:latest | ||
|
||
## Copy file to server | ||
|
||
scp -i /Users/vinova/ssh_pem/tap-dev.pem /Users/vinova/Docker/docker-fwd-tapp-frontend.tar ubuntu@18.140.74.12:/home/ubuntu/fwdfrontent | ||
|
||
## Remove image tar after copy file to server completed | ||
|
||
rm /Users/vinova/Docker/docker-fwd-tapp-frontend.tar | ||
|
||
## Remove folder project after completed | ||
|
||
rm -rf /Users/vinova/Project/fwd-tapp-web-frontend | ||
|
||
## Remove images fwd.web.frontend:latest | ||
|
||
docker rmi -f fwd.web.frontend:latest | ||
|
||
## Remove untagged images | ||
|
||
docker image prune | ||
|
||
# Working on server client | ||
|
||
## SSH to server dev | ||
|
||
ssh -i /Users/vinova/ssh_pem/tap-dev.pem ubuntu@18.140.74.12 | ||
|
||
## Stop current container running | ||
|
||
sudo docker stop fwd-frontend | ||
|
||
## Remove current container running | ||
|
||
sudo docker rm fwd-frontend | ||
|
||
## Remove images fwd.web.frontend:latest | ||
|
||
sudo docker rmi -f fwd.web.frontend:latest | ||
|
||
## Import image to docker | ||
|
||
sudo docker load < /home/ubuntu/fwdfrontent/docker-fwd-tapp-frontend.tar | ||
|
||
## Run Image with container | ||
|
||
sudo docker run -d -p 80:80 -p 443:443 --restart always --name fwd-frontend fwd.web.frontend:latest | ||
|
||
## Remove image tar after run container completed | ||
|
||
rm /home/ubuntu/fwdfrontent/docker-fwd-tapp-frontend.tar | ||
|
||
# Script into Jenskin | ||
|
||
``` | ||
cd /Users/vinova/Project && | ||
git clone --single-branch --branch develop git@gitlab.com:vinova/fwd/fwd-tapp-web-frontend.git && | ||
cd fwd-tapp-web-frontend && | ||
docker build --tag fwd.web.frontend:latest . && | ||
docker save --output /Users/vinova/Docker/docker-fwd-tapp-frontend.tar fwd.web.frontend:latest && | ||
scp -i /Users/vinova/ssh_pem/tap-dev.pem /Users/vinova/Docker/docker-fwd-tapp-frontend.tar ubuntu@18.140.74.12:/home/ubuntu/fwdfrontent && | ||
rm /Users/vinova/Docker/docker-fwd-tapp-frontend.tar && | ||
rm -rf /Users/vinova/Project/fwd-tapp-web-frontend && | ||
docker rmi -f fwd.web.frontend:latest && | ||
docker image prune && | ||
ssh -i /Users/vinova/ssh_pem/tap-dev.pem ubuntu@18.140.74.12 'sudo docker stop fwd-frontend && sudo docker rm fwd-frontend && sudo docker rmi -f fwd.web.frontend:latest && sudo docker load < /home/ubuntu/fwdfrontent/docker-fwd-tapp-frontend.tar && sudo docker run -d -p 80:80 --restart always --name fwd-frontend fwd.web.frontend:latest && rm /home/ubuntu/fwdfrontent/docker-fwd-tapp-frontend.tar' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# Vinova-academy | ||
Vinova-academy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} |
Oops, something went wrong.