Implementation steps for docker deployment of springboot and vue projects

Implementation steps for docker deployment of springboot and vue projects

A. Docker deployment of springboot project

1. Springboot project compilation and packaging

2. Create a Dockerfile file in the project root directory

FROM openjdk:8-jdk-alpine
VOLUME /tmp
ADD ./target/demo-0.0.1-SNAPSHOT.jar demo.jar
RUN sh -c 'touch /demo.jar'
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /demo.jar"]

demo-0.0.1-SNAPSHOT.jar is changed to your jar package name

If the jar package is running in Java, use openjdk:8-jdk-alpine

3. Execute in the root directory to form a docker image

docker build -t demmo-docker:1.0 .

4. Run the project

docker run docker run -dp 8080:8080 --name demo-docker demo-docker:1.0

B. Docker deployment of VUE project

1. Compile and package the VUE project and execute it in the project root directory

npm run build

After execution, there will be a dist folder

2. Copy dist to an empty folder and create a Dockerfile file

FROM nginx
MAINTAINER admin
COPY dist/ /usr/share/nginx/html/

The dist folder contains html, css and other files. You can use nginx to run html.

3. Execute in the parent folder of Dockerfile to form a docker image

docker build -t demo-vue-docker .

4. Run the project

docker run --name car-vue -d -p 8080:80 demo-vue-docker

C. Export the image

docker save -o demo.tar demo-docker:1.0
docker save -o vue-demo.tar demo-vue-docker

D. Copy the tar file to the server

Copy the file to the server. The rar file is in the user directory. For example, on a Mac, it will be in /Users/your username/. If you can't find the file, you can use a tool to find it.

E. Import the image

docker load -i demo.tar
docker load -i vue-demo.tar

F. Run the project

It is consistent with the above description and will not be repeated here.

This is the end of this article about the implementation steps of docker deployment springboot and vue projects. For more relevant docker deployment springboot and vue project content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Docker container deployment of front-end Vue service (novice tutorial)
  • How to deploy Vue project using Docker image + nginx
  • Teach you how to deploy Vue project with Docker
  • vue-cli3 project from construction optimization to docker deployment method
  • Deploy Vue program using Docker container

<<:  Corporate website and column dictionary Chinese and English comparison Friends who make Chinese and English bilingual corporate websites need

>>:  Introduction to the use of html base tag target=_parent

Recommend

HTML table tag tutorial (32): cell horizontal alignment attribute ALIGN

In the horizontal direction, you can set the cell...

MySQL 8.0.24 installation and configuration method graphic tutorial

This article shares the installation tutorial of ...

Implementation principle and configuration of MySql master-slave replication

Database read-write separation is an essential an...

Two types of tab applications in web design

Nowadays, tabs are widely used in web design, but...

Analysis of MySQL general query log and slow query log

The logs in MySQL include: error log, binary log,...

TypeScript generic parameter default types and new strict compilation option

Table of contents Overview Create a type definiti...

Solutions to problems using addRoutes in Vue projects

Table of contents Preface 1. 404 Page 1. Causes 2...

Explanation of the precautions for Mysql master-slave replication

1. Error error connecting to master 'x@xxxx:x...

How to use the yum command

1. Introduction to yum Yum (full name Yellow dogU...

CSS web page responsive layout to automatically adapt to PC/Pad/Phone devices

Preface There are many devices nowadays, includin...

A brief analysis of crontab task scheduling in Linux

1. Create a scheduling task instruction crontab -...

How to quickly install Nginx in Linux

Table of contents What is nginx 1. Download the r...