FROM adoptopenjdk/openjdk11-openj9

ARG GITBUCKET_HOME

# create home
RUN mkdir -p $GITBUCKET_HOME

# mark volumes
VOLUME $GITBUCKET_HOME/repositories
VOLUME $GITBUCKET_HOME/data
VOLUME $GITBUCKET_HOME/gist
VOLUME $GITBUCKET_HOME/plugins

# Port for web page and Port for SSH access to git repository (Optional)
EXPOSE 8080 8443 29418

COPY server-WIN-DOMAIN-CA.cer /
COPY SSLPoke.java /

# ADD https://github.com/gitbucket/gitbucket/releases/download/4.38.4/gitbucket.war $GITBUCKET_HOME/gitbucket.war
COPY gitbucket.war $GITBUCKET_HOME

RUN keytool -importcert -file /server-WIN-DOMAIN-CA.cer -alias "server-WIN-DOMAIN-CA" -cacerts -storepass changeit -noprompt
	
# set environment
WORKDIR $GITBUCKET_HOME

CMD ["sh", "-c", "java $JAVA_OPTS -jar $GITBUCKET_HOME/gitbucket.war"]