Question

How can I use Digital Ocean app platform with PHP 8.2

I have a Symfony project, and I want to deploy it using the Digital Ocean app platform, I tried buildpack-php, but not support PHP 8.2 also I tried Dockerfile solution the build passed but the deployment step field

my Dockerfile:

FROM composer:2.5.8 AS _composer
_
FROM node:18.17.1-alpine3.18 AS _pnpm
_WORKDIR /app
ENV _PNPM_HOME_="/pnpm"
ENV _PATH_="$_PNPM_HOME_:$_PATH_"
RUN corepack enable
COPY "package.json" "pnpm-lock.yaml" "webpack.config.js" "postcss.config.js" "tailwind.config.js" "tsconfig.json" ./

FROM php:8.2-fpm-alpine3.18 as _base
_WORKDIR /app
COPY . .
COPY --from=_composer_ /usr/bin/composer /usr/bin/composer
RUN docker-php-ext-install bcmath \
    && apk add --no-cache icu-dev \
    && docker-php-ext-install intl
RUN apk add bash

FROM base AS _vendor
_RUN APP_ENV=prod APP_DEBUG=0 composer install --no-dev --optimize-autoloader \
    && APP_ENV=prod APP_DEBUG=0 php bin/console cache:clear

FROM pnpm AS _prod-deps
_RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile

FROM pnpm AS _build
_COPY --from=_vendor_ /app/vendor /app/vendor
COPY --from=_base_ /app/assets /app/assets
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm build

FROM base AS _buildpack
_RUN apk add git \
    && mkdir "./buildpack" \
    && git clone https://github.com/heroku/heroku-buildpack-php.git ./buildpack

FROM base
COPY --from=_base_ /app /app
COPY --from=_prod-deps_ /app/node_modules /app/node_modules
COPY --from=_vendor_ /app/vendor /app/vendor
COPY --from=_build_ /app/public/assets /app/public/assets
COPY --from=_buildpack_ /app/buildpack /app/buildpack
RUN apk --no-cache add ca-certificates

my App Spec file

alerts:
- rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED
databases:
- engine: PG
  name: db
  num_nodes: 1
  size: basic-xs
  version: "12"
ingress:
  rules:
  - component:
      name: staging-stubwizard-com
    match:
      path:
        prefix: /
name: staging-stubwizard-com
region: nyc
services:
- dockerfile_path: Dockerfile
  envs:
  - key: DATABASE_URL
    scope: RUN_TIME
    value: ${db.DATABASE_URL}
  github:
    branch: develop
    deploy_on_push: true
    repo: makraz/stubwizard.com
  http_port: 8080
  instance_count: 1
  instance_size_slug: basic-xxs
  name: staging-stubwizard-com
  run_command: buildpack/bin/heroku-php-nginx -C bin/nginx_app.conf public/
  source_dir: /

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Jon Friesen
DigitalOcean Employee
DigitalOcean Employee badge
August 24, 2023
Accepted Answer

👋 Hi Hamza,

We are in the process of rolling out a new stack which might resolve this issue using our buildpack system. Adding a feature flag to your app spec will opt your app into the new stack during it’s rollout, for example:

features:
- buildpack-stack=ubuntu-22
alerts:
- rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED
databases:
- engine: PG
  name: db
  num_nodes: 1
  size: basic-xs
  version: "12"
ingress:
  rules:
  - component:
      name: staging-stubwizard-com
    match:
      path:
        prefix: /
name: staging-stubwizard-com
region: nyc
services:
- dockerfile_path: Dockerfile
  envs:
  - key: DATABASE_URL
    scope: RUN_TIME
    value: ${db.DATABASE_URL}
  github:
    branch: develop
    deploy_on_push: true
    repo: makraz/stubwizard.com
  http_port: 8080
  instance_count: 1
  instance_size_slug: basic-xxs
  name: staging-stubwizard-com
  run_command: buildpack/bin/heroku-php-nginx -C bin/nginx_app.conf public/
  source_dir: /

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel