前后端通过docker部署笔记

  1. 项目背景:这是一个SpringBoot+vue3的项目,通过maven打包后,需要在Linux服务器上部署,本篇博客主要记录docker-compose.yaml文件的含义:
    在这里插入图片描述

docker-compose.yml 文件中定义了一个 algorithm_platform_frontend 容器,该容器基于 nginx:latest 镜像,并通过数据卷 (volumes) 绑定了 前端静态文件Nginx 配置文件。下面详细解析各个参数的作用,以及 :z 选项的含义。


1. docker-compose.yml 解析

algorithm_platform_frontend:
  image: nginx:latest
  container_name: algorithm_platform_frontend
  hostname: algorithm_platform_frontend
  restart: unless-stopped
  volumes:
    - ./frontend/html:/usr/share/nginx/html