Skip to content

Instantly share code, notes, and snippets.

@sunxyw
Created February 27, 2023 16:35
Show Gist options
  • Save sunxyw/7323795ef21d3273b4cdd5da02491ce9 to your computer and use it in GitHub Desktop.
Save sunxyw/7323795ef21d3273b4cdd5da02491ce9 to your computer and use it in GitHub Desktop.
Zhamao Framework Production Dockerfile
FROM phpswoole/swoole:latest as pack
RUN echo "phar.readonly=0" >> /usr/local/etc/php/conf.d/docker-php-ext-phar.ini
WORKDIR /app
COPY . .
RUN composer install --no-dev --optimize-autoloader --no-interaction --no-progress
RUN mkdir -p /app/build && /app/zhamao build --build-dir=/app/build --target=zm.phar --quiet
FROM alpine:latest as build
ADD https://dl.zhamao.xin/php-bin/file/micro-8.1.8-x86_64.tar.gz /tmp
RUN tar -zxvf /tmp/micro-8.1.8-x86_64.tar.gz -C /tmp
COPY --from=pack /app/build /app/build
RUN cat /tmp/micro.sfx /app/build/zm.phar > /app/build/zm
RUN chmod +x /app/build/zm
FROM alpine:latest
COPY --from=build --chmod=0755 /app/build/zm /usr/local/bin/zm
ENTRYPOINT ["zm"]
CMD ["server"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment