Skip to content

Instantly share code, notes, and snippets.

@SammyK
Last active April 10, 2019 03:02
Show Gist options
  • Save SammyK/4a5cf70d0973731d0c85b151a323ea2d to your computer and use it in GitHub Desktop.
Save SammyK/4a5cf70d0973731d0c85b151a323ea2d to your computer and use it in GitHub Desktop.
Writing tests for php-src: Docker setup

Docker setup for writing tests for php-src

These are the Docker files I used for the screencasts about writing tests for php-src.

Installation

Just copy these files into a directory and also create a subdirectory called docker-mount. This can be accessed from within the container at /usr/src.

One-time build

For the first run you'll need to build the container.

$ docker-compose build

The build should install pretty much all the need deps that we ended up installing in the screencasts.

Run & TTY

Once it's built, you shouldn't have to run that again. Now you can just run the container and access the TTY with user sammyk. That user has sudo access with password test123.

$ docker-compose up
$ docker exec -it -u sammyk phptscreencast_web_1 bash

I hope this helps some of you! Good luck with your tests! :)

version: "3"
services:
web:
image: phpt_screencast:latest
build: .
volumes:
- ./docker-mount:/usr/src
ports:
- "8888:8888"
tty: true
FROM ubuntu:16.04
MAINTAINER Sammy Kaye Powers
RUN apt-get update \
&& apt-get install sudo vim git -y \
&& apt-get install build-essential autoconf valgrind -y \
&& apt-get install re2c bison -y \
&& apt-get install libxml2-dev locales lcov -y
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN groupadd developers \
&& adduser --disabled-password --gecos "" --ingroup developers sammyk \
&& echo "sammyk:test123" | chpasswd \
&& touch /etc/sudoers.d/sammyk \
&& chmod 0440 /etc/sudoers.d/sammyk \
&& echo 'sammyk ALL=(ALL) ALL' | tee -a /etc/sudoers.d/sammyk
RUN echo 'PS1="\[\033[31m\]\u@💩 \[\033[34m\]\W\[\033[32m\] \\$\[\033[0m\] "' >> /root/.bashrc
RUN echo 'PS1="\[\033[36m\]\u@💩 \[\033[34m\]\W\[\033[32m\] \\$\[\033[0m\] "' >> /home/sammyk/.bashrc
EXPOSE 8888
@SammyK
Copy link
Author

SammyK commented Aug 11, 2017

Updated - thanks! :)

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