webman的Dockerfile

admin

1.把下方内容复制到 Dockerfile文件,放入webman应用的根目录(start.php同级)

#最小的alpine Linux(10Mb)
FROM alpine:latest

#安装init
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
   && apk add wget curl nload php7-cli php7-redis php7-pcntl php7-posix php7-iconv php7-pdo php7-gd php7-pdo_mysql \
  && apk add composer \
   && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

WORKDIR /app
COPY / /app

RUN    composer install \
        && mkdir -p /tmp/logs \
         && mkdir -p /tmp/sessions \
        && mkdir -p /tmp/views \
        && rm -rf /app/runtime \
        && ln -s /tmp  /app/runtime

#暴露8787端口
EXPOSE 8787

CMD ["php","/app/start.php","start"]

2.构建镜像,

在当前目录执行,最后有一个 .别忘记复制

docker build -t webman:latest .

3.启动webman镜像,吧容器8787映射到宿主机80端口

docker run -it -p 80:8787 webman:latest 

2457 3 4
3个评论

admin

如果缺什么拓展就apk 安装,例如

apk add php7-xxx

如果缺linux指令,例如

apk add wget  curl nload  screen gcc
  • qkhhxkj 2021-12-09

    跑不起来说是没有 event 大佬怎么安装呢

  • admin 2021-12-10
    # apk add libevent
    (1/1) Installing libevent (2.1.12-r2)
    OK: 8 MiB in 20 packages
    / # 
qkhhxkj

我的是这样的
是不是因为我用的是 gateway

  • admin 2021-12-10

    我的dockerfile仅仅针对webman http(workerman4.x)服务,如果是gatewayworker 我会再出一个的,

  • qkhhxkj 2021-12-10

    大佬在呀,谢谢了我坐等 ^_^

  • ysy49271743 2021-12-11

    坐等大佬,谢谢

kylin87

executor failed running [/bin/sh -c sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && apk add wget curl nload php7-cli php7-redis php7-pcntl php7-posix php7-iconv php7-pdo php7-gd php7-pdo_mysql && apk add composer && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/]: exit code: 8

  • admin 2023-05-28

    FROM alpine:latest

    换成
    FROM alpine:3.16.0

年代过于久远,无法发表评论

admin

6404
积分
0
获赞数
0
粉丝数
2021-08-06 加入
×
🔝