Контейнер разработчика PhpStorm на базовом образе PHPPhp

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Контейнер разработчика PhpStorm на базовом образе PHP

Сообщение Anonymous »

У меня уже есть сложная реализация контейнеров разработчика VS Code с большим количеством настроек, но я изо всех сил пытаюсь запустить ее на PhpStorm. Если я использую официальный образ mcr.microsoft.com/devcontainers/php, он работает, но я хочу использовать свой образ, основанный на официальном образе php:fpm. Он даже не запустится, даже если я добавлю все необходимые библиотеки поддержки (он компилируется, но PhpStorm всегда не сможет запустить внутри него контейнеры разработки).

Код: Выделить всё

Dockerfile
:

Код: Выделить всё

ARG PHP_VERSION=8.4
# Use PHP official image (Debian based, Alpine is not supported :( )
FROM php:${PHP_VERSION}-fpm

# Php running user and group
ARG USER_NAME=user
ARG USER_GROUP=user
ARG USER_UID=1000
ARG USER_GID=1000

### Setup user and group ###
RUN set -x && \
if getent group ${USER_GID} > /dev/null 2>&1; \
then groupmod -g ${USER_GID} ${USER_GROUP}; \
else groupadd -g ${USER_GID} ${USER_GROUP}; \
fi && \
if id -u ${USER_UID} > /dev/null 2>&1; \
then usermod -u ${USER_UID} -g ${USER_GID} ${USER_NAME}; \
else useradd -m -d /home/${USER_NAME}/ \
-s /bin/bash \
-u ${USER_UID} \
-g ${USER_GID} \
${USER_NAME}; \
fi  &&  \
rmdir /var/www/html &&\
chown -R ${USER_UID}:${USER_GID} /home/$USER_NAME &&\
chown -R ${USER_UID}:${USER_GID} /var/www

### Install PHPStorm Devcontainer dependencies ###
RUN apt-get update && apt-get install -y --no-install-recommends \
#  JetBrains Runtime (JBR) librarires
libxext6 libxrender1 libxtst6 libxi6 libfreetype6 fontconfig \
#
libnss3 libdbus-1-3 libatk1.0-0 libatk-bridge2.0-0 libcups2 \
libdrm2 libgbm1 libasound2 \
# Utilities
procps socat curl \
# Locales
locales \
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
&& locale-gen && \
rm -rf /var/lib/apt/lists/*  && \
# Fix folder permissions
mkdir -p /.jbdevcontainer /home/${USER_NAME}/.cache /home/${USER_NAME}/.local/share/JetBrains \
&& chown -R ${USER_NAME}:${USER_NAME} /.jbdevcontainer /home/${USER_NAME}
# Fix lang
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8

# Switch to user
USER ${USER_NAME}

Код: Выделить всё

docker-compose.yml
:

Код: Выделить всё

services:
app:
build:
context: .
dockerfile: Dockerfile

#    volumes:
#      - ../htdocs..:/workspaces:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

Код: Выделить всё

devcontainer.json
:

Код: Выделить всё

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/php-mariadb
{
"name": "PHPStorm test devContainer",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"remoteUser": "user",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",

// Features to add to the dev container.  More info: https://containers.dev/features.
// "features": {},

// For use with PHP or Apache (e.g.php -S localhost:8080 or apache2ctl start)
"forwardPorts": [8080],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html"

"customizations" : {
"jetbrains" : {
"backend" : "PhpStorm"
}
}
}
Я использую последнюю версию PhpStorm (EAP) в WSL2 (это не должно быть проблемой).
Сообщение об ошибке (во время запуска devcontainer):

Код: Выделить всё

==== FAILURES ====

The following exception failed the deployment
com.jetbrains.gateway.ssh.deploy.DeployException: IJent unexpectedly closed during initial protocol exchange
at com.jetbrains.gateway.ssh.DeployFlowUtil$fullDeployCycleImpl$2.invokeSuspend(DeployFlowUtil.kt:329)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:36)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:101)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:47)
at kotlinx.coroutines.UndispatchedCoroutine.afterResume(CoroutineContext.kt:277)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:101)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:47)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at kotlinx.coroutines.internal.SoftLimitedDispatcher$Worker.run(SoftLimitedDispatcher.kt:130)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:610)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:1188)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:775)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:762)
Caused by: com.jetbrains.gateway.ssh.deploy.DeployException: IJent unexpectedly closed during initial protocol exchange
at com.jetbrains.gateway.ssh.DeployFlowUtil$fullDeployCycleImpl$2.invokeSuspend(DeployFlowUtil.kt:327)
... 14 more
Caused by: com.intellij.platform.ijent.IjentUnavailableException$CommunicationFailure: IJent unexpectedly closed during initial protocol exchange
at com.intellij.platform.ijent.impl.GrpcIjentSessionProviderKt.readLine(GrpcIjentSessionProvider.kt:537)
at com.intellij.platform.ijent.impl.GrpcIjentSessionProviderKt.access$readLine(GrpcIjentSessionProvider.kt:1)
at com.intellij.platform.ijent.impl.GrpcIjentSessionProviderKt$initialProtocolExchange$2.invokeSuspend(GrpcIjentSessionProvider.kt:501)
at com.intellij.platform.ijent.impl.GrpcIjentSessionProviderKt$initialProtocolExchange$2.invoke(GrpcIjentSessionProvider.kt)
at com.intellij.platform.ijent.impl.GrpcIjentSessionProviderKt$initialProtocolExchange$2.invoke(GrpcIjentSessionProvider.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndspatched(Undispatched.kt:67)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:43)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:165)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
at com.intellij.platform.ijent.impl.GrpcIjentSessionProviderKt.initialProtocolExchange(GrpcIjentSessionProvider.kt:500)
at com.intellij.platform.ijent.impl.GrpcIjentSessionProviderKt.create(GrpcIjentSessionProvider.kt:385)
at com.intellij.platform.ijent.impl.GrpcIjentSessionProviderKt.access$create(GrpcIjentSessionProvider.kt:1)
at com.intellij.platform.ijent.impl.GrpcIjentSessionProvider.connect(GrpcIjentSessionProvider.kt:201)
at com.intellij.platform.ijent.spi.IjentSessionProviderKt.createIjentSession(IjentSessionProvider.kt:51)
at com.intellij.platform.ijent.spi.IjentControlledEnvironmentDeployingStrategy.createIjentSession(IjentControlledEnvironmentDeployingStrategy.kt:84)
at com.intellij.platform.ijent.spi.IjentControlledEnvironmentDeployingStrategy$createIjentSession$1.invokeSuspend(IjentControlledEnvironmentDeployingStrategy.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
...  10 more

==== ENVIRONMENT ====

INSTALLED PRODUCTS

PhpStorm    261.17801.67
PhpStorm    261.20869.47
PhpStorm    261.19799.22

AVAILABLE MEMORY

15,22GB
Примечание. Я опубликовал базовый пример для устранения проблемы; мой базовый образ по-прежнему основан на php:fpm, но имеет множество настроек и настроек, которые я хочу сохранить, чтобы быть уверенным, что разрабатываю с теми же настройками, которые использую в рабочей среде, использование mcr.microsoft.com/devcontainers или других изображений не является жизнеспособным решением.


Подробнее здесь: https://stackoverflow.com/questions/798 ... base-image
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»