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

Docker cleaning killer/Docker overlay file takes up too much disk space

[Looking at all the migration files on the Intern...

Teach you how to build a Hadoop 3.x pseudo cluster on Tencent Cloud

1. Environmental Preparation CentOS Linux release...

Advantages and disadvantages of conditional comments in IE

IE's conditional comments are a proprietary (...

Summary of React's way of creating components

Table of contents 1. Create components using func...

Install three or more tomcats under Linux system (detailed steps)

If you want to install multiple tomcats, you must...

How to elegantly back up MySQL account information

Preface: I recently encountered the problem of in...

Example of CSS3 to achieve div sliding in and out from bottom to top

1. First, you need to use the target selector of ...

Linux kernel device driver system call notes

/**************************** * System call******...

Detailed explanation of TIMESTAMPDIFF case in MySQL

1. Syntax TIMESTAMPDIFF(unit,begin,end); Returns ...

Do you know all 24 methods of JavaScript loop traversal?

Table of contents Preface 1. Array traversal meth...

Mysql database index interview questions (basic programmer skills)

Table of contents introduction Indexing principle...

Example of how to deploy MySQL 8.0 using Docker

1. Refer to the official website to install docke...