You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
riskclouddocker/risk_cloud_backend_Dockerfile

37 lines
1.3 KiB

FROM php:7.4.13-fpm-alpine3.12
#切换阿里云镜像源
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
##安装php扩展
#gd
RUN apk add freetype-dev libjpeg-turbo-dev libpng-dev && docker-php-ext-install gd
##zip
RUN apk add --no-cache libzip-dev && docker-php-ext-install zip
##pdo_mysql
RUN docker-php-ext-install pdo_mysql
#git
RUN apk add git openssh
#设置环境变量
ENV name=RiskCloudBackend
#拷贝公钥免密克隆仓库代码
COPY .ssh /root/.ssh
#拷贝到容器里的密钥需要修改权限才能正常使用
RUN chmod 400 /root/.ssh/id_rsa
#拷贝项目文件
RUN cd / && git clone git@gogs.kirito.cool:panqihua/${name}.git
#切换到项目目录
WORKDIR /${name}
#目录读写权限
RUN chmod +x /${name} -R
#授权php-fpm访问项目所有文件权限
RUN chown -R www-data:www-data *
#安装composer
RUN php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');" && \
php composer-setup.php && \
php -r "unlink('composer-setup.php');" && \
mv composer.phar /usr/local/bin/composer
ARG proxy
ENV proxy=$proxy
##设置代理,使用composer安装依赖
RUN export http_proxy=socks5://${proxy}:1080 && export https_proxy=socks5://${proxy}:1080 && composer install && composer dumpautoload
#设置服务器文件存储目录创建软链接
RUN php artisan storage:link