Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Use Docker base image #35

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 1 addition & 56 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,73 +9,18 @@ COPY composer.json /usr/local/src/
RUN composer install --ignore-platform-reqs --optimize-autoloader \
--no-plugins --no-scripts --prefer-dist

# Prepare generic compiler
FROM php:8.3.7-cli-alpine3.19 as compile

ENV PHP_SWOOLE_VERSION=v5.1.2

RUN \
apk add --no-cache --virtual .deps \
make \
automake \
autoconf \
gcc \
g++ \
git \
linux-headers \
openssl-dev \
curl-dev

RUN docker-php-ext-install sockets

# Compile Swoole
FROM compile AS swoole

RUN \
git clone --depth 1 --branch $PHP_SWOOLE_VERSION https://github.com/swoole/swoole-src.git && \
cd swoole-src && \
phpize && \
./configure --enable-sockets --enable-http2 --enable-openssl --enable-swoole-curl && \
make && make install && \
cd ..

# Proxy
FROM php:8.3.7-cli-alpine3.19 as final
FROM openruntimes/base:0.1.0 as final

ARG OPR_PROXY_VERSION
ENV OPR_PROXY_VERSION=$OPR_PROXY_VERSION

LABEL maintainer="team@appwrite.io"

RUN \
apk update \
&& apk add --no-cache --virtual .deps \
make \
automake \
autoconf \
curl-dev \
gcc \
g++ \
linux-headers \
&& apk add --no-cache \
libstdc++ \
&& docker-php-ext-install sockets \
&& apk del .deps \
&& rm -rf /var/cache/apk/*

WORKDIR /usr/local/

# Source code
COPY ./app /usr/local/app
COPY ./src /usr/local/src

# Extensions and libraries
COPY --from=composer /usr/local/src/vendor /usr/local/vendor
COPY --from=swoole /usr/local/lib/php/extensions/no-debug-non-zts-20230831/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/

RUN echo extension=swoole.so >> /usr/local/etc/php/conf.d/swoole.ini

EXPOSE 80

HEALTHCHECK --interval=30s --timeout=15s --start-period=60s --retries=3 CMD curl -s -H "Authorization: Bearer ${OPR_PROXY_SECRET}" --fail http://127.0.0.1:80/v1/proxy/health

Expand Down
Loading