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

Specific use of Mysql prepare preprocessing

Table of contents 1. Preprocessing 2. Pretreatmen...

Detailed explanation of MySQL information_schema database

1. Overview The information_schema database is th...

Detailed explanation of setting Context Path in Web application

URL: http://hostname.com/contextPath/servletPath/...

The front-end must know how to lazy load images (three methods)

Table of contents 1. What is lazy loading? 2. Imp...

Usage and difference of Js module packaging exports require import

Table of contents 1. Commonjs exports and require...

Several common redirection connection example codes in html

Copy code The code is as follows: window.location...

5 ways to determine whether an object is an empty object in JS

1. Convert the json object into a json string, an...

HTML hyperlinks explained in detail

Hyperlink Hyperlinks are the most frequently used ...

Example code for realizing charging effect of B station with css+svg

difficulty Two mask creation of svg graphics Firs...

Detailed analysis of SQL execution steps

Detailed analysis of SQL execution steps Let'...

Basic usage tutorial of MySQL slow query log

Slow query log related parameters MySQL slow quer...

CSS3 transition to implement notification message carousel

Vue version, copy it to the file and use it <t...

Comparison of the usage of EXISTS and IN in MySQL

1. Usage: (1) EXISTS usage select a.batchName,a.p...

Script example for starting and stopping spring boot projects in Linux

There are three ways to start a springboot projec...

MySQL SQL statement analysis and query optimization detailed explanation

How to obtain SQL statements with performance iss...