mirror of
https://github.com/ledgersmb/ledgersmb-docker.git
synced 2025-04-26 17:47:10 -04:00
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. Some reordering for docker cache optimisation.
This commit is contained in:
parent
c72c18bc9e
commit
cd2beca88c
25
Dockerfile
25
Dockerfile
@ -37,10 +37,19 @@ RUN apt-get install -y \
|
|||||||
App::LedgerSMB::Admin
|
App::LedgerSMB::Admin
|
||||||
|
|
||||||
# Install LedgerSMB
|
# Install LedgerSMB
|
||||||
|
|
||||||
|
# Clone upstream git repository:
|
||||||
ENV LSMB_REPO_UPSTREAM=https://github.com/ledgersmb/LedgerSMB.git
|
ENV LSMB_REPO_UPSTREAM=https://github.com/ledgersmb/LedgerSMB.git
|
||||||
RUN cd /srv && \
|
RUN cd /srv && \
|
||||||
git clone $LSMB_REPO_UPSTREAM ledgersmb
|
git clone $LSMB_REPO_UPSTREAM ledgersmb
|
||||||
|
|
||||||
|
# Set git remote source, eg: --build-arg LSMB_REPO=https://github.com/ehuelsmann/LedgerSMB.git
|
||||||
|
ARG LSMB_REPO=${LSMB_REPO_UPSTREAM}
|
||||||
|
WORKDIR /srv/ledgersmb
|
||||||
|
# add remote repo as alt
|
||||||
|
RUN git remote add alt ${LSMB_REPO} \
|
||||||
|
&& git fetch alt
|
||||||
|
|
||||||
# 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;
|
||||||
# eg:
|
# eg:
|
||||||
@ -50,22 +59,16 @@ RUN cd /srv && \
|
|||||||
# then docker's caching will see nothing new and you'll end up with stale files
|
# then docker's caching will see nothing new and you'll end up with stale files
|
||||||
# if that branch/tag has already been cached.
|
# if that branch/tag has already been cached.
|
||||||
#
|
#
|
||||||
# As a hack to reliably update a branch (eg, master), --build-arg CACHEBREAK="$(date)":
|
|
||||||
# eg: docker build --build-arg CACHEBREAK="$(date)" --build-arg LSMB_VERSION=master .
|
|
||||||
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}
|
||||||
|
|
||||||
# Set git remote source, eg: --build-arg LSMB_REPO=https://github.com/ehuelsmann/LedgerSMB.git
|
# As a hack to reliably update a branch (eg, master), --build-arg CACHEBREAK="$(date)":
|
||||||
ARG LSMB_REPO=${LSMB_REPO_UPSTREAM}
|
# eg: docker build --build-arg CACHEBREAK="$(date)" --build-arg LSMB_VERSION=master .
|
||||||
|
ARG CACHEBREAK
|
||||||
|
|
||||||
WORKDIR /srv/ledgersmb
|
# fetch alt (fetches changes since the last fetch)
|
||||||
|
|
||||||
# add remote repo as alt
|
|
||||||
# fetch alt (fetches differences between the initial git clone and current alt remote)
|
|
||||||
# checkout specified tag/branch/commit from alt; no need for merge because it's detached
|
# checkout specified tag/branch/commit from alt; no need for merge because it's detached
|
||||||
RUN git remote add alt ${LSMB_REPO} \
|
RUN git fetch alt \
|
||||||
&& git fetch alt \
|
|
||||||
&& git checkout alt/$LSMB_VERSION
|
&& git checkout alt/$LSMB_VERSION
|
||||||
|
|
||||||
#RUN sed -i \
|
#RUN sed -i \
|
||||||
|
Loading…
Reference in New Issue
Block a user