coolify/docker/prod-ssu/Dockerfile

65 lines
2.4 KiB
Docker
Raw Normal View History

2023-06-15 10:56:36 +02:00
FROM serversideup/php:8.2-fpm-nginx as base
WORKDIR /var/www/html
COPY composer.json composer.lock ./
RUN composer install --no-dev --no-interaction --no-plugins --no-scripts --prefer-dist
2023-04-13 15:48:27 +02:00
FROM node:19 as static-assets
WORKDIR /app
COPY . .
2023-06-15 10:56:36 +02:00
COPY --from=base --chown=9999:9999 /var/www/html .
2023-04-13 15:48:27 +02:00
RUN npm install
RUN npm run build
2023-04-12 21:23:32 +02:00
FROM serversideup/php:8.2-fpm-nginx
2023-09-23 13:34:40 +02:00
ARG TARGETPLATFORM
# https://github.com/cloudflare/cloudflared/releases
ARG CLOUDFLARED_VERSION=2023.8.2
2023-04-12 21:23:32 +02:00
ARG POSTGRES_VERSION=15
2023-06-15 13:41:25 +02:00
2023-09-23 13:34:40 +02:00
WORKDIR /var/www/html
2023-07-28 14:44:26 +02:00
RUN apt-get update
2023-06-15 13:41:25 +02:00
# Postgres version requirements
RUN apt install dirmngr ca-certificates software-properties-common gnupg gnupg2 apt-transport-https curl -y
RUN curl -fSsL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/postgresql.gpg > /dev/null
2023-06-15 13:42:04 +02:00
RUN echo deb [arch=amd64,arm64,ppc64el signed-by=/usr/share/keyrings/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main | tee -a /etc/apt/sources.list.d/postgresql.list
2023-06-15 13:41:25 +02:00
2023-07-28 14:44:26 +02:00
RUN apt-get update
2023-06-15 13:41:25 +02:00
RUN apt-get install postgresql-client-$POSTGRES_VERSION -y
# Coolify requirements
2023-07-28 14:44:26 +02:00
RUN apt-get install -y php-pgsql openssh-client git git-lfs jq lsof
2023-05-16 10:12:34 +02:00
RUN apt-get -y autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
2023-04-12 21:23:32 +02:00
2023-05-26 10:37:18 +02:00
COPY docker/prod-ssu/nginx.conf /etc/nginx/conf.d/custom.conf
2023-06-15 10:56:36 +02:00
COPY --from=base --chown=9999:9999 /var/www/html .
2023-06-15 11:02:37 +02:00
COPY --chown=9999:9999 . .
RUN composer dump-autoload
COPY --from=static-assets --chown=9999:9999 /app/public/build ./public/build
COPY --chmod=755 docker/prod-ssu/etc/s6-overlay/ /etc/s6-overlay/
2023-04-13 15:48:27 +02:00
2023-06-15 11:02:37 +02:00
RUN php artisan route:cache
RUN php artisan view:cache
2023-05-16 10:07:08 +02:00
RUN echo "alias ll='ls -al'" >>/etc/bash.bashrc
RUN echo "alias a='php artisan'" >>/etc/bash.bashrc
2023-05-26 09:45:18 +02:00
RUN echo "alias logs='tail -f storage/logs/laravel.log'" >>/etc/bash.bashrc
2023-09-23 13:34:40 +02:00
RUN mkdir -p /usr/local/bin
RUN /bin/bash -c "if [[ ${TARGETPLATFORM} == 'linux/amd64' ]]; then \
echo 'amd64' && \
curl -sSL https://github.com/cloudflare/cloudflared/releases/download/${CLOUDFLARED_VERSION}/cloudflared-linux-amd64 -o /usr/local/bin/cloudflared && chmod +x /usr/local/bin/cloudflared \
;fi"
RUN /bin/bash -c "if [[ ${TARGETPLATFORM} == 'linux/arm64' ]]; then \
echo 'arm64' && \
curl -L https://github.com/cloudflare/cloudflared/releases/download/${CLOUDFLARED_VERSION}/cloudflared-linux-arm64 -o /usr/local/bin/cloudflared && chmod +x /usr/local/bin/cloudflared \
;fi"