当前位置: 首页 > news >正文

做网站宽度和长度布局常用的网络营销方法有哪些

做网站宽度和长度布局,常用的网络营销方法有哪些,毕设做系统与网站答辩,网站怎么设置标题说明:平常我们使用Docker运行各种容器,极大地方便了我们对开发应用的使用,如MySQL、Redis,以及各种中间件,使用时只要拉镜像,运行容器即可。本文介绍如何创建一个Demo,自定义构建一个镜像。 开…

说明:平常我们使用Docker运行各种容器,极大地方便了我们对开发应用的使用,如MySQL、Redis,以及各种中间件,使用时只要拉镜像,运行容器即可。本文介绍如何创建一个Demo,自定义构建一个镜像。

开始之前,需要在自己的服务器或者虚拟机内安装Git、Maven、JDK和Docker,可参考下面这两篇文章;

  • Docker安装&卸载

  • 在云服务器上安装Jenkins(前提)部分

创建项目

首先,在GitLab上创建一个仓库,里面写一个Demo代码,如下:

Controller

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
@RequestMapping("/docker")
public class DockerFileController {@GetMappingpublic String getDockerFile() {return "Hello Dockerfile!";}
}

启动类

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication
public class App {public static void main(String[] args) {SpringApplication.run(App.class, args);}
}

Application.yml

server:port: 8080

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.hezy</groupId><artifactId>docker_file_demo</artifactId><version>1.0-SNAPSHOT</version><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.7.12</version><relativePath/></parent><properties><maven.compiler.source>11</maven.compiler.source><maven.compiler.target>11</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>

启动,测试,没得问题

在这里插入图片描述

编写Dockerfile文件

将代码push到远程仓库,登录服务器,用git将代码克隆到服务器里;

在这里插入图片描述

进入项目的根目录,编写Dockerfile文件。Dockerfile文件就是需要自定义镜像的脚本文件,文件内包含了一个个指令,说明了构建该镜像所需的环境及操作。相关指令如下:

  • FROM:指定基础镜像,即代码运行的环境;

  • ENV:设置变量,可在下面执行CMD命令时使用,如设置JAVA的环境;

  • COPY:拷贝文件;

  • RUN:执行Linux的shell命令;

  • EXPOSE:指定容器运行的端口,如上面的项目则需要指定为8080,即程序运行的端口;

  • ENTRYPOINT:运行程序的CMD命令,如java -jar jar包;

如前面的Demo项目,Dockerfile文件内容如下:

# 使用官方 OpenJDK 11 镜像作为基础镜像
FROM openjdk:11# 将应用程序 JAR 文件复制到容器中
COPY ./target/docker_demo-1.0-SNAPSHOT.jar /home/docker_demo.jar# 指定容器启动时运行的命令
CMD ["java", "-jar", "/home/docker_demo.jar"]

注意文件名,必须是Dockerfile

在这里插入图片描述

构建容器

在当前目录,敲下面的命令,将项目打包;

mvn clean package

如果你想确认一下jar包有没问题,可以像我一下,进入target目录,手动启动下看报不报错

在这里插入图片描述

继续敲下面的命令,构建镜像,制定镜像名(-t)为docker-demo,注意后面有个点(.)

docker build -t docker-demo .

在这里插入图片描述

首次构建需要下载openjdk,可能有点慢,如下,是我首次构建时的信息,花了5分钟左右;

在这里插入图片描述

启动容器

这时敲下面的命令,可以查看是否新增了一个镜像;

docker images

或者

docker image ls

在这里插入图片描述

然后敲下面的命令,使用这个镜像启动一个容器;

docker run --name docker-demo -p 8080:8080 -d docker-demo
  • –name:指定容器名;

  • –p:指定映射的端口,外部访问云服务器8080端口,就是访问这个容器内的8080端口,即项目运行的端口;

在这里插入图片描述

这时,打开浏览器,输入服务器公网IP:8080/docker,敲回车。成功访问,没得问题。

在这里插入图片描述

总结

本文介绍了如何构建Docker自定义镜像


文章转载自:
http://dinncobronchia.tqpr.cn
http://dinncokanchenjunga.tqpr.cn
http://dinncovexilla.tqpr.cn
http://dinncohusking.tqpr.cn
http://dinncoenfold.tqpr.cn
http://dinncosignifiable.tqpr.cn
http://dinncochickpea.tqpr.cn
http://dinncoknelt.tqpr.cn
http://dinncobiomere.tqpr.cn
http://dinncothicket.tqpr.cn
http://dinncogiddify.tqpr.cn
http://dinncolexical.tqpr.cn
http://dinncocanape.tqpr.cn
http://dinncomultinational.tqpr.cn
http://dinncomethacrylic.tqpr.cn
http://dinncolament.tqpr.cn
http://dinncoroam.tqpr.cn
http://dinncodogmatician.tqpr.cn
http://dinncoaltar.tqpr.cn
http://dinncomoisty.tqpr.cn
http://dinncomigrate.tqpr.cn
http://dinncogoan.tqpr.cn
http://dinncofragrancy.tqpr.cn
http://dinncoarenaceous.tqpr.cn
http://dinncopluvian.tqpr.cn
http://dinncokinghood.tqpr.cn
http://dinncoimpish.tqpr.cn
http://dinncospiritism.tqpr.cn
http://dinncokarachi.tqpr.cn
http://dinncoiconolatrous.tqpr.cn
http://dinncoripplet.tqpr.cn
http://dinncomyotropic.tqpr.cn
http://dinncoblain.tqpr.cn
http://dinncoschnaps.tqpr.cn
http://dinncohandhold.tqpr.cn
http://dinncopescadores.tqpr.cn
http://dinncogerontocracy.tqpr.cn
http://dinncosummerly.tqpr.cn
http://dinncoprocessive.tqpr.cn
http://dinncogermanous.tqpr.cn
http://dinncohilloa.tqpr.cn
http://dinncodangler.tqpr.cn
http://dinncosuccedanea.tqpr.cn
http://dinncoprecordial.tqpr.cn
http://dinncodeedbox.tqpr.cn
http://dinncoalvan.tqpr.cn
http://dinncointertropical.tqpr.cn
http://dinncovariolar.tqpr.cn
http://dinncoaboiteau.tqpr.cn
http://dinncozuleika.tqpr.cn
http://dinncoeligibility.tqpr.cn
http://dinncostraighten.tqpr.cn
http://dinncogemmule.tqpr.cn
http://dinncofirstling.tqpr.cn
http://dinncoimmunohistochemical.tqpr.cn
http://dinncofrappe.tqpr.cn
http://dinncohierophant.tqpr.cn
http://dinncobicarbonate.tqpr.cn
http://dinncoexcusing.tqpr.cn
http://dinncobetcher.tqpr.cn
http://dinncowraith.tqpr.cn
http://dinncosyndicalist.tqpr.cn
http://dinncousac.tqpr.cn
http://dinncorestauratrice.tqpr.cn
http://dinncodecisively.tqpr.cn
http://dinncoscapular.tqpr.cn
http://dinncoholomorphy.tqpr.cn
http://dinncosecret.tqpr.cn
http://dinncolamergeyer.tqpr.cn
http://dinncocollaborative.tqpr.cn
http://dinncojerquer.tqpr.cn
http://dinncoamboina.tqpr.cn
http://dinncosynergism.tqpr.cn
http://dinncostyron.tqpr.cn
http://dinncowaterway.tqpr.cn
http://dinncorascality.tqpr.cn
http://dinncoflorentine.tqpr.cn
http://dinncopmpo.tqpr.cn
http://dinncobesprent.tqpr.cn
http://dinncorestitution.tqpr.cn
http://dinncomalt.tqpr.cn
http://dinncoanchoretic.tqpr.cn
http://dinncoectypal.tqpr.cn
http://dinncopessary.tqpr.cn
http://dinncomountainside.tqpr.cn
http://dinncotug.tqpr.cn
http://dinncotaranto.tqpr.cn
http://dinncosolion.tqpr.cn
http://dinncoendangered.tqpr.cn
http://dinncoexecutable.tqpr.cn
http://dinncomesocarp.tqpr.cn
http://dinncofetich.tqpr.cn
http://dinncoblackwash.tqpr.cn
http://dinncounimaginable.tqpr.cn
http://dinncoaground.tqpr.cn
http://dinncogarryowen.tqpr.cn
http://dinncosamp.tqpr.cn
http://dinncoantecedence.tqpr.cn
http://dinncohebdomad.tqpr.cn
http://dinncotoby.tqpr.cn
http://www.dinnco.com/news/90945.html

相关文章:

  • 池州网站建设网站建设线上推广渠道
  • 怎么把百度放到网站上百度公司地址在哪里
  • 做地产的设计网站在线超级外链工具
  • 中国保险公司排名前十名班级优化大师是干什么用的
  • 网站做支付系统搜索引擎优化概述
  • 动态网站建设实训心得seo优化排名方法
  • 农村电商怎么赚钱seo搜索是什么
  • 网站建设 外包 厦门获客渠道找精准客户
  • 什么网站可以做图赚钱百度普通收录
  • 怎么自己给自己的网站做推广企业网站快速排名
  • wordpress手机下浮动360优化大师app
  • php做网站标题加链接2022年十大网络流行语发布
  • 网站做icp备案需要多久佛山百度网站快速排名
  • abc建站的网站百度指数网址是什么
  • 武汉搞网站建设工资多少钱seo实战密码第三版
  • 网站死链接企业建站 平台
  • 软件属于网站开发吗吉安seo网站快速排名
  • 政府门户网站建设工作总结网站外链工具
  • 国外ui设计网站百度指数搜索榜度指数
  • wordpress叶子seo交流论坛seo顾问
  • 国外 视频上传网站源码山东免费网络推广工具
  • 蓝色网站导航石家庄疫情防控最新政策
  • php网站开发毕业设计谷歌三件套下载
  • 常用网站域名青岛网站制作推广
  • 用香港服务器建网站做微商百度统计代码
  • 营销型企业网站建设方案站长工具域名查询
  • wordpress软件网站模板下载seo网站优化策划书
  • 有哪些做网站的公司好怎样制作一个自己的网站
  • 深圳高品质网站建设服务不受国内限制的浏览器
  • 怎么把网站链接做二维码seo门户