anchor.diff:      && apk add --no-cache --virtual .gosu-deps \
           dpkg \
           gnupg \
  -    && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture | sed s/musl-linux-//)" \
  -    && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture  | sed s/musl-linux-//).asc" \
  +    && curl -fSsL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture | sed s/musl-linux-//)" \
  +    && curl -fSsL -o /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture  | sed s/musl-linux-//).asc" \
       && export GNUPGHOME="$(mktemp -d)" \
  -    && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
  -    && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
  +    && echo "honor-http-proxy" > ${GNUPGHOME}/dirmngr.conf \
  +    && gpg2 --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
  +    && gpg2 --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
       && rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
       && chmod +x /usr/local/bin/gosu \
       && gosu nobody true \
  
positive.code: ENV GERRITFORGE_URL=https://gerrit-ci.gerritforge.com
  ENV GERRITFORGE_ARTIFACT_DIR=lastSuccessfulBuild/artifact/buck-out/gen/plugins
  #delete-project
  RUN wget \
      ${GERRITFORGE_URL}/job/plugin-delete-project-${PLUGIN_VERSION}/${GERRITFORGE_ARTIFACT_DIR}/delete-project/delete-project.jar \
      -O ${GERRIT_HOME}/delete-project.jar
  
  #events-log
  #This plugin is required by gerrit-trigger plugin of Jenkins.
  RUN wget \
      ${GERRITFORGE_URL}/job/plugin-events-log-${PLUGIN_VERSION}/${GERRITFORGE_ARTIFACT_DIR}/events-log/events-log.jar \
      -O ${GERRIT_HOME}/events-log.jar
  
  #oauth2 plugin
  RUN wget \
      https://github.com/davido/gerrit-oauth-provider/releases/download/v${GERRIT_VERSION}/gerrit-oauth-provider.jar \
      -O ${GERRIT_HOME}/gerrit-oauth-provider.jar
  
  #download bouncy castle
  ENV BOUNCY_CASTLE_VERSION 1.54
  ENV BOUNCY_CASTLE_URL http://central.maven.org/maven2/org/bouncycastle
  
  RUN wget \
      ${BOUNCY_CASTLE_URL}/bcprov-jdk15on/${BOUNCY_CASTLE_VERSION}/bcprov-jdk15on-${BOUNCY_CASTLE_VERSION}.jar \
      -O ${GERRIT_HOME}/bcprov-jdk15on-${BOUNCY_CASTLE_VERSION}.jar
  
  RUN wget \
      ${BOUNCY_CASTLE_URL}/bcpkix-jdk15on/${BOUNCY_CASTLE_VERSION}/bcpkix-jdk15on-${BOUNCY_CASTLE_VERSION}.jar \
      -O ${GERRIT_HOME}/bcpkix-jdk15on-${BOUNCY_CASTLE_VERSION}.jar
  
  # Ensure the entrypoint scripts are in a fixed location
  COPY gerrit-entrypoint.sh /
  
negative.code: RUN mkdir /docker-entrypoint-init.d
  
  #Download gerrit.war
  RUN curl -fSsL https://gerrit-releases.storage.googleapis.com/gerrit-${GERRIT_VERSION}.war -o $GERRIT_WAR
  #Only for local test
  #COPY gerrit-${GERRIT_VERSION}.war $GERRIT_WAR
  
  