Skip to content

Instantly share code, notes, and snippets.

@aude

aude/test.md Secret

Last active November 23, 2020 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aude/590aa6f8363f237cd5fe2d1791bf5be5 to your computer and use it in GitHub Desktop.
Save aude/590aa6f8363f237cd5fe2d1791bf5be5 to your computer and use it in GitHub Desktop.
Test webdevops/php-dev:7.3 with wp-cli

Here's a test of the proposed solution to https://stackoverflow.com/questions/58559536

# Dockerfile comes from this Stack Overflow question: https://stackoverflow.com/q/58559536
FROM webdevops/php-dev:7.3

# configure postfix to use mailhog
RUN postconf -e "relayhost = mail:1025"

# NOTE: this command is changed, comes from this answer: https://stackoverflow.com/a/58929460
# install wp cli
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
    chmod +x wp-cli.phar && \
    mv wp-cli.phar /usr/local/bin/wp-cli.phar && \
    echo '#!/bin/sh' >> /usr/local/bin/wp && \
    echo 'wp-cli.phar "$@" --allow-root' >> /usr/local/bin/wp && \
    chmod +x /usr/local/bin/wp

WORKDIR /var/www/html/
$ docker build -t wp-cli-test .
Sending build context to Docker daemon   2.56kB
Step 1/4 : FROM webdevops/php-dev:7.3
 ---> df16e743b65e
Step 2/4 : RUN postconf -e "relayhost = mail:1025"
 ---> Using cache
 ---> 2f421e892aeb
Step 3/4 : RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar &&     chmod +x wp-cli.phar &&     mv wp-cli.phar /usr/local/bin/wp-cli.phar &&     echo '#!/bin/sh' >> /usr/local/bin/wp &&     echo 'wp-cli.phar "$@" --allow-root' >> /usr/local/bin/wp &&     chmod +x /usr/local/bin/wp
 ---> Using cache
 ---> 9c2265d7757e
Step 4/4 : WORKDIR /var/www/html/
 ---> Using cache
 ---> 54917036abba
Successfully built 54917036abba
Successfully tagged wp-cli-test:latest
$ docker run --rm wp-cli-test /usr/local/bin/wp cli
usage: wp cli alias <command>
   or: wp cli cache <command>
   or: wp cli check-update [--patch] [--minor] [--major] [--field=<field>] [--fields=<fields>] [--format=<format>]
   or: wp cli cmd-dump
   or: wp cli completions --line=<line> --point=<point>
   or: wp cli has-command <command_name>...
   or: wp cli info [--format=<format>]
   or: wp cli param-dump [--with-values] [--format=<format>]
   or: wp cli update [--patch] [--minor] [--major] [--stable] [--nightly] [--yes]
   or: wp cli version

See 'wp help cli <command>' for more information on a specific command.
$ docker run --rm wp-cli-test wp cli
usage: wp cli alias <command>
   or: wp cli cache <command>
   or: wp cli check-update [--patch] [--minor] [--major] [--field=<field>] [--fields=<fields>] [--format=<format>]
   or: wp cli cmd-dump
   or: wp cli completions --line=<line> --point=<point>
   or: wp cli has-command <command_name>...
   or: wp cli info [--format=<format>]
   or: wp cli param-dump [--with-values] [--format=<format>]
   or: wp cli update [--patch] [--minor] [--major] [--stable] [--nightly] [--yes]
   or: wp cli version

See 'wp help cli <command>' for more information on a specific command.
$ docker image rm wp-cli-test:latest
Untagged: wp-cli-test:latest

Seems to run OK in this test. Maybe I'm missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment