mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 01:08:41 +00:00
chore(install/bundle): let Dockerfile get current branch when building
Previous the branch in Dockerfile is specified manually in each branch. But when someone want to change the branch or test they must modify it. To make the process more intelligent, we will auto get the branch name. And, to make the image smaller, we added --single-branch argument onto.
This commit is contained in:
parent
2565c18256
commit
e0914a8f31
@ -1,10 +1,11 @@
|
|||||||
FROM ubuntu:18.04
|
FROM ubuntu:18.04
|
||||||
MAINTAINER MascoSkray <MascoSkray@gmail.com>
|
MAINTAINER MascoSkray <MascoSkray@gmail.com>
|
||||||
|
ARG CLONE_ADDFLAG
|
||||||
|
|
||||||
#Update apt and install git
|
#Update apt and install git
|
||||||
RUN apt-get update && apt-get install -y git
|
RUN apt-get update && apt-get install -y git
|
||||||
#Clone the latest UOJ Community verison to local
|
#Clone the latest UOJ Community verison to local
|
||||||
RUN cd ~ && git clone https://github.com/UniversalOJ/UOJ-System.git --depth 1
|
RUN cd ~ && git clone https://github.com/UniversalOJ/UOJ-System.git --depth 1 --single-branch ${CLONE_ADDFLAG}
|
||||||
#Install environment and set startup script
|
#Install environment and set startup script
|
||||||
RUN cd ~/UOJ-System/install/bundle && sh install.sh -p && echo "\
|
RUN cd ~/UOJ-System/install/bundle && sh install.sh -p && echo "\
|
||||||
#!/bin/sh\n\
|
#!/bin/sh\n\
|
||||||
|
6
install/bundle/hooks/build
Normal file
6
install/bundle/hooks/build
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
CLONE_ADDFLAG="-b $DOCKER_TAG"
|
||||||
|
if [ "$DOCKER_TAG" = "latest" ]; then
|
||||||
|
CLONE_ADDFLAG="-b master"
|
||||||
|
fi
|
||||||
|
docker build -t $IMAGE_NAME --build-arg CLONE_ADDFLAG="$CLONE_ADDFLAG" .
|
Loading…
Reference in New Issue
Block a user