Accept alternate git url with --build-arg LSMB_REPO=

Also fetch && checkout no longer need to be followed by a merge since checkout is now detached.
This commit is contained in:
maikkeli 2016-01-30 03:03:12 +10:30
parent d2cc634b4e
commit c72c18bc9e

View File

@ -37,8 +37,9 @@ RUN apt-get install -y \
App::LedgerSMB::Admin App::LedgerSMB::Admin
# Install LedgerSMB # Install LedgerSMB
ENV LSMB_REPO_UPSTREAM=https://github.com/ledgersmb/LedgerSMB.git
RUN cd /srv && \ RUN cd /srv && \
git clone https://github.com/ledgersmb/LedgerSMB.git ledgersmb git clone $LSMB_REPO_UPSTREAM ledgersmb
# Set LedgerSMB version (git tag/branch/commit) # Set LedgerSMB version (git tag/branch/commit)
# Change LSMB_VERSION or use --build-arg on docker build commandline; # Change LSMB_VERSION or use --build-arg on docker build commandline;
@ -55,15 +56,17 @@ ARG CACHEBREAK
ARG LSMB_VERSION=1.5.0-beta3 ARG LSMB_VERSION=1.5.0-beta3
ENV LSMB_VERSION ${LSMB_VERSION} ENV LSMB_VERSION ${LSMB_VERSION}
# fetch changes to repo since possibly cached git clone above. # Set git remote source, eg: --build-arg LSMB_REPO=https://github.com/ehuelsmann/LedgerSMB.git
# checkout specified tag/branch/commit (**NOTE above) ARG LSMB_REPO=${LSMB_REPO_UPSTREAM}
# merge changes to current checked out branch
WORKDIR /srv/ledgersmb WORKDIR /srv/ledgersmb
RUN git fetch \ # add remote repo as alt
&& git checkout $LSMB_VERSION \ # fetch alt (fetches differences between the initial git clone and current alt remote)
&& (git merge || echo "git merge failed - this is expected if [$LSMB_VERSION] isn't a branch") # checkout specified tag/branch/commit from alt; no need for merge because it's detached
RUN git remote add alt ${LSMB_REPO} \
&& git fetch alt \
&& git checkout alt/$LSMB_VERSION
#RUN sed -i \ #RUN sed -i \
# -e "s/short_open_tag = Off/short_open_tag = On/g" \ # -e "s/short_open_tag = Off/short_open_tag = On/g" \