Vauxoo / travis2docker

This is a Library to transform travis to docker file
BSD 2-Clause "Simplified" License
13 stars 15 forks source link

[REF] support for addons->apt->sources and addons->apt->packages #4

Closed moylop260 closed 7 years ago

moylop260 commented 9 years ago

Translate next yaml

 addons:
   apt:
    sources:
      - pov-wkhtmltopdf
     packages:
       - expect-dev
       - python-lxml
       - python-simplejson
       - python-yaml
       - wkhtmltopdt

to next execute script as root user

add-apt-repository ppa:pov/wkhtmltopdf
apt-get update
apt-get install expect-dev python-lxml python-simplejson python-yaml wkhtmltopdt

Using next whitelists: https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise

To generate next Dockerfile

USER root
RUN add-apt-repository ppa:pov/wkhtmltopdf && apt-get update && \
    apt-get install expect-dev python-lxml python-simplejson python-yaml wkhtmltopdf

RUN mv /usr/bin/sudo /usr/bin/disable_sudo

ADD files/ssh /home/travis/.ssh
ENV TRAVIS_BUILD_DIR=/home/travis/build/Vauxoo/odoo-mexico-v2
WORKDIR ${TRAVIS_BUILD_DIR}
RUN chown -R travis:travis /home/travis && touch /entrypoint.sh && chown -R travis:travis /entrypoint.sh && chmod +x /entrypoint.sh 
# or use  RUN touch /entrypoint.sh &&  chmod +x /entrypoint.sh && chown -R travis:travis /home/travis /entrypoint.sh

USER travis
RUN git init ${TRAVIS_BUILD_DIR} \
    && cd ${TRAVIS_BUILD_DIR} \
    && git remote add ...
...

Create python environment to install packages

virtualenv -p /usr/bin/python2.7 venv
source venv/bin/activate
RUN virtualenv -p /usr/bin/python2.7 venv && . venv/bin/activate; INSTALL_SECTION
RUN  . venv/bin/activate; PATH=${HOME}/maintainer-quality-tools/travis:${PATH} INSTALL_SECTION2

RUN  . venv/bin/activate; PATH=${HOME}/maintainer-quality-tools/travis:${PATH} script seccion
...
. venv/bin/activate; /entrypoint.sh

and set password to users travis and root

moylop260 commented 7 years ago

Fixed from 3.0.0 version