Vauxoo / travis2docker

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

[IMP] t2d: add new argument --build-extra-steps #210

Closed antonag32 closed 10 months ago

antonag32 commented 11 months ago

Similar to --run-extra-cmds, --build-extra-cmds, this new argument allows users to add extra steps at the end of the generated Dockerfile.

Closes #209.

codecov-commenter commented 11 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (485b1e8) 79.29% compared to head (4376286) 79.36%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #210 +/- ## ========================================== + Coverage 79.29% 79.36% +0.06% ========================================== Files 7 7 Lines 594 596 +2 Branches 108 108 ========================================== + Hits 471 473 +2 Misses 90 90 Partials 33 33 ``` | [Files](https://app.codecov.io/gh/Vauxoo/travis2docker/pull/210?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vauxoo) | Coverage Δ | | |---|---|---| | [src/travis2docker/cli.py](https://app.codecov.io/gh/Vauxoo/travis2docker/pull/210?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vauxoo#diff-c3JjL3RyYXZpczJkb2NrZXIvY2xpLnB5) | `76.69% <100.00%> (+0.22%)` | :arrow_up: | | [src/travis2docker/travis2docker.py](https://app.codecov.io/gh/Vauxoo/travis2docker/pull/210?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vauxoo#diff-c3JjL3RyYXZpczJkb2NrZXIvdHJhdmlzMmRvY2tlci5weQ==) | `82.47% <100.00%> (+0.06%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

antonag32 commented 11 months ago

Tested with the following args:

--deployv
--docker-image quay.io/vauxoo/kukyflor:kukyflor-16.0-44740fa
--build-extra-steps "RUN echo hello" "RUN echo bye"
git@git.vauxoo.com:vauxoo/kukyflor.git 16.0

And the resulting Dockerfile:

FROM quay.io/vauxoo/kukyflor:kukyflor-16.0-44740fa

ARG HOME=/home/odoo

# rm -rf /home/odoo/.ssh
COPY .ssh $HOME/.ssh

COPY build.sh /home/odoo/build.sh

COPY entrypoint_deployv.sh /entrypoint.sh

COPY docker_helper /home/odoo/build

COPY .vscode /home/odoo/.vscode

COPY .coveragerc /home/odoo/.coveragerc
RUN chown -R odoo:odoo $HOME/.ssh;chown -R odoo:odoo /home/odoo/build.sh;chown -R odoo:odoo /entrypoint.sh;chown -R odoo:odoo /home/odoo/build;chown -R odoo:odoo /home/odoo/.vscode;chown -R odoo:odoo /home/odoo/.coveragerc;

ENV ODOORC_DB_NAME=odoo ODOORC_PIDFILE=/home/odoo/.odoo.pid ODOORC_DATA_DIR=/home/odoo/data_dir PROFILE_FILE=/etc/bash.bashrc MAIN_REPO_FULL_PATH=/home/odoo/instance/$MAIN_REPO_PATH DEB_PYTHON_INSTALL_LAYOUT=deb
ENV COVERAGE_RCFILE=$HOME/.coveragerc
ENV COVERAGE_HOME=$MAIN_REPO_FULL_PATH

# Create cluster with odoo as owner and use environment variables instead of odoo cfg to connect
RUN . /home/odoo/build.sh && \
    install_dev_tools && \
    service_postgres_without_sudo odoo odoo && \
    install_pgcli_venv && \
    custom_alias && \
    odoo_conf && \
    git_set_remote && \
    bash_colorized && \
    setup_coverage && \
    configure_vim && \
    configure_zsh && \
    chown_all && \
    set_authorized_keys && \
    mv /entrypoint_image /deployv_entrypoint_image && \
    mv /entry_point.py /deployv_entry_point.py && \
    mkdir /run/sshd

USER odoo

# TODO: Use .profile as bash profiler by default

ENTRYPOINT /entrypoint.sh

WORKDIR $MAIN_REPO_FULL_PATH

RUN echo hello

RUN echo bye
antonag32 commented 11 months ago

CI fails but that's because I deleted .travis.yaml on a previous commit and did not realize it would break, since tests run against the main branch upstream and not local code. I have added it back and once merged, tests should pass. Tested it on my fork>

https://github.com/antonag32/travis2docker/actions/runs/6826672573