Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit c327af9

Browse files
committed
Update php-mariadb to use pre-built image (CI Ignore)
1 parent 5970e01 commit c327af9

File tree

6 files changed

+25
-311
lines changed

6 files changed

+25
-311
lines changed
Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,31 @@
1-
# Update the VARIANT arg in docker-compose.yml to pick a PHP version
1+
# Update the VARIANT arg in docker-compose.yml to pick a PHP version: 7, 7.4, 7.3
22
ARG VARIANT=7
3-
FROM php:${VARIANT}-cli
3+
FROM mcr.microsoft.com/vscode/devcontainers/php:dev-${VARIANT}
44

5-
# Options for setup script
6-
ARG INSTALL_ZSH="true"
7-
ARG UPGRADE_PACKAGES="false"
8-
ARG USERNAME=vscode
9-
ARG USER_UID=1000
10-
ARG USER_GID=$USER_UID
11-
12-
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
13-
COPY library-scripts/common-debian.sh /tmp/library-scripts/
14-
RUN apt-get update \
15-
&& /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
5+
# Install MariaDB client
6+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
167
&& apt-get install -y mariadb-client \
17-
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/library-scripts
8+
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/library-scripts
189

19-
# Install xdebug
20-
RUN yes | pecl install xdebug \
21-
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
22-
&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
23-
&& echo "xdebug.remote_autostart=on" >> /usr/local/etc/php/conf.d/xdebug.ini
10+
# Update args in docker-compose.yaml to set the UID/GID of the "vscode" user.
11+
ARG USER_UID=1000
12+
ARG USER_GID=$USER_UID
13+
RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \
14+
groupmod --gid $USER_GID vscode \
15+
&& usermod --uid $USER_UID --gid $USER_GID vscode \
16+
&& chmod -R $USER_UID:$USER_GID /home/vscode \
17+
&& chmod -R $USER_UID:root /usr/local/share/nvm; \
18+
fi
2419

25-
# [Optional] Install Node.js for use with web applications - update the INSTALL_NODE arg in docker-compose.yml to enable.
26-
ARG INSTALL_NODE="false"
20+
# [Optional] Install a version of Node.js using nvm for front end dev
21+
ARG INSTALL_NODE="true"
2722
ARG NODE_VERSION="lts/*"
28-
ENV NVM_DIR=/usr/local/share/nvm
29-
ENV NVM_SYMLINK_CURRENT=true \
30-
PATH=${NVM_DIR}/current/bin:${PATH}
31-
COPY library-scripts/node-debian.sh /tmp/library-scripts/
32-
RUN if [ "$INSTALL_NODE" = "true" ]; then /bin/bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}"; fi \
33-
&& rm -rf /var/lib/apt/lists/* /tmp/library-scripts
23+
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
3424

35-
# [Optional] Uncomment this section to install additional packages.
25+
# [Optional] Uncomment this section to install additional OS packages.
3626
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
3727
# && apt-get -y install --no-install-recommends <your-package-list-here>
3828

29+
# [Optional] Uncomment this line to install global node packages.
30+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
31+

containers/php-mariadb/.devcontainer/devcontainer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
22
// https://github.com/microsoft/vscode-dev-containers/tree/v0.112.0/containers/php-7
33
{
4-
"name": "PHP 7 & MariaDB",
4+
"name": "PHP & MariaDB",
55
"dockerComposeFile": "docker-compose.yml",
66
"service": "php",
77

@@ -14,7 +14,8 @@
1414
"extensions": [
1515
"felixfbecker.php-debug",
1616
"felixfbecker.php-intellisense",
17-
"mtxr.sqltools"
17+
"mtxr.sqltools",
18+
"mtxr.sqltools-driver-mysql"
1819
],
1920

2021
"workspaceFolder": "/workspace",

containers/php-mariadb/.devcontainer/docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ services:
1010
context: .
1111
dockerfile: Dockerfile
1212
args:
13-
# Update VARIANT to pick a PHP version
13+
# Update VARIANT to pick a PHP version: 7, 7.4, 7.3
1414
VARIANT: "7"
1515
INSTALL_NODE: "true"
1616
NODE_VERSION: "lts/*"
17-
# On Linux, you may need to update USER_UID and USER_GID below if not your local UID is not 1000.
1817
USER_UID: 1000
1918
USER_GID: 1000
2019

containers/php-mariadb/.devcontainer/library-scripts/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

containers/php-mariadb/.devcontainer/library-scripts/common-debian.sh

Lines changed: 0 additions & 171 deletions
This file was deleted.

containers/php-mariadb/.devcontainer/library-scripts/node-debian.sh

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)