/dockerizing-commands

Dockeirizing language commands

Primary LanguageDockerfile

Dockerizing Commands

About

The idea of this project is dockerizing the language commands, to be not more necessary had installed the languages on the machine to run simple commands

PHP

Available versions:

  • 7.3 - omarkdev/cli-php:7.3
  • 8.1 - omarkdev/cli-php:8.1
  • 8.2 - omarkdev/cli-php:8.2

All versions include composer command.

Setting alias

You can set up the alias:

alias php="docker run --rm --tty -it \
    -u $(id -u):$(id -g) \
    -v $(pwd):/app \
    -v $HOME/.ssh:/home/sammy/.ssh \
    -w /app \
    omarkdev/cli-php:8.1 \
    php"

alias composer="docker run --rm --tty -it \
    -u $(id -u):$(id -g) \
    -v $(pwd):/app \
    -v $HOME/.ssh:/home/sammy/.ssh \
    -w /app \
    omarkdev/cli-php:8.1 \
    composer"

These alias are the most basic, including: non-root user and copy ssh keys to inside the container. It's important to see the alias will sync the volume to folder where the command as ran, so it's basically to you run commands to specific projects, but feel free to change.

The basic command include a copy of ssh to inside the container to allow installing private repositories.

Without SSH

You can set up the alias without ssh copy too:

alias php="docker run --rm --tty -it \
    -u $(id -u):$(id -g) \
    -v $(pwd):/app \
    -w /app \
    omarkdev/cli-php:8.1 \
    php"

alias composer="docker run --rm --tty -it \
    -u $(id -u):$(id -g) \
    -v $(pwd):/app \
    -w /app \
    omarkdev/cli-php:8.1 \
    composer"

How to contribute

All images are inside the containers folder, you can create a new one, or update an existing one.

Commands usually used:

  • docker build -t omarkdev/cli-php:8.1 -f containers/php/8.1/
  • docker tag omarkdev/cli-php:8.1 omarkdev/cli-php:8.1
  • docker push omarkdev/cli-php:8.1