服务器现在正在使用此配置。
version: '3'
services:
nginx:
image: nginx:latest
ports:
- "80:80"
- "443:443"
volumes:
- ./www:/var/www
depends_on:
- php
php:
build: ./docker/images/php
volumes:
- ./www:/var/www
mysql:
image: mysql
ports:
- "3306:3306"
volumes:
- ./docker/mysql:/var/lib/mysql
- ./docker/import:/docker-entrypoint-initdb.d
environment:
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
用于 php 映像的 Dockerfile
# Main image
FROM php:7.3-fpm
# Update and install modules for php and other
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
&& apt-get install -y wget zip unzip git \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd pdo mysqli pdo_mysql \
&& docker-php-ext-enable mysqli
# Workdir for php
WORKDIR /var/www
# Run container
CMD ["php-fpm"]
我想将golang容器添加到此配置中,以便我可以golang从cron.
问题是:
做这个的最好方式是什么?
如何将其专门添加到docker-compose/Dockerfile并从中运行cron?
慕姐4208626
相关分类