docker-compose部署爱影cms

kimlopezkimlopez
1 min read

1.创建Dockerfile


FROM debian:latest
WORKDIR /user/app
COPY . /user/app
RUN apt-get -qq update \
    && apt-get -qq install -y --no-install-recommends ca-certificates curl
EXPOSE 21007
RUN chmod +x /user/app/cms
CMD ["/user/app/cms"]

2.创建docker-compose

version: '3.8'

services:
  # IYCMS 应用服务
  iycms:
    build: 
      context: .
      dockerfile: Dockerfile
    container_name: iycms-app
    depends_on:
      - postgres
    ports:
      - "127.0.0.1:21007:21007"    # 后台管理端口
      - "127.0.0.1:21006:80"    # 站点端口
    networks:
      - iycms_network
    volumes:
      - ./app:/app
      - ./logs:/app/logs
    restart: unless-stopped

  # PostgreSQL 数据库服务
  postgres:
    image: postgres:15-alpine
    container_name: iycms-postgres
    environment:
      - POSTGRES_DB=iycms_db
      - POSTGRES_USER=iycms_user
      - POSTGRES_PASSWORD=you_security_pwd
    ports:
      - "5432:5432"
    networks:
      - iycms_network
    volumes:
      - postgres_data:/var/lib/postgresql/data
    restart: unless-stopped

# 持久化数据卷
volumes:
  postgres_data:
  pgadmin_data:

# 自定义网络
networks:
  iycms_network:
    driver: bridge

3.安装爱影CMS

访问http://ip:21007,然后进入安装,填写数据库相关信息,这里数据库选择外部数据库,地址填入compose种的postgres

0
Subscribe to my newsletter

Read articles from kimlopez directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

kimlopez
kimlopez