2020-06-08 13:37:14 -07:00
|
|
|
# This "container" is a workaround to pre-create search indices
|
2021-02-24 16:00:16 -08:00
|
|
|
|
|
|
|
# Defining environment
|
|
|
|
ARG APP_ENV=prod
|
|
|
|
|
2022-12-26 10:09:08 -06:00
|
|
|
FROM alpine:3 AS base
|
2021-08-10 22:22:36 -07:00
|
|
|
ENV DOCKERIZE_VERSION v0.6.1
|
2021-12-14 02:39:48 +09:00
|
|
|
RUN apk add --no-cache curl jq tar bash coreutils \
|
2021-08-10 22:22:36 -07:00
|
|
|
&& curl -L https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz | tar -C /usr/local/bin -xzv
|
2019-09-12 19:04:29 -07:00
|
|
|
|
2021-02-24 16:00:16 -08:00
|
|
|
FROM base AS prod-install
|
|
|
|
|
2020-12-02 20:49:34 -08:00
|
|
|
COPY docker/elasticsearch-setup/create-indices.sh /
|
|
|
|
RUN chmod 755 create-indices.sh
|
2021-11-22 16:33:14 -08:00
|
|
|
COPY metadata-service/restli-servlet-impl/src/main/resources/index /index
|
2021-02-24 16:00:16 -08:00
|
|
|
|
|
|
|
FROM base AS dev-install
|
|
|
|
# Dummy stage for development. Use local files for setup
|
|
|
|
# See this excellent thread https://github.com/docker/cli/issues/1134
|
2019-09-12 19:04:29 -07:00
|
|
|
|
2021-02-24 16:00:16 -08:00
|
|
|
FROM ${APP_ENV}-install AS final
|
2021-03-28 06:21:10 +03:00
|
|
|
CMD if [ "$ELASTICSEARCH_USE_SSL" == "true" ]; then ELASTICSEARCH_PROTOCOL=https; else ELASTICSEARCH_PROTOCOL=http; fi \
|
2021-09-16 03:11:51 +02:00
|
|
|
&& if [[ -n "$ELASTICSEARCH_USERNAME" ]]; then ELASTICSEARCH_HTTP_HEADERS="Authorization: Basic $(echo -ne "$ELASTICSEARCH_USERNAME:$ELASTICSEARCH_PASSWORD" | base64)"; else ELASTICSEARCH_HTTP_HEADERS="Accept: */*"; fi \
|
2021-12-08 10:50:08 +09:00
|
|
|
&& if [[ "$SKIP_ELASTICSEARCH_CHECK" != "true" ]]; then \
|
|
|
|
dockerize -wait $ELASTICSEARCH_PROTOCOL://$ELASTICSEARCH_HOST:$ELASTICSEARCH_PORT -wait-http-header "${ELASTICSEARCH_HTTP_HEADERS}" -timeout 120s /create-indices.sh; \
|
|
|
|
else /create-indices.sh; fi
|