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
2023-11-28 21:52:11 +01:00
# Defining custom repo urls for use in enterprise environments. Re-used between stages below.
ARG ALPINE_REPO_URL = http://dl-cdn.alpinelinux.org/alpine
2025-08-01 11:21:23 -05:00
FROM alpine:3.22 AS base
2023-11-28 21:52:11 +01:00
ARG ALPINE_REPO_URL
# Optionally set corporate mirror for apk
RUN if [ " ${ ALPINE_REPO_URL } " != " http : //dl-cdn.alpinelinux.org/alpine " ] ; then sed -i " s #http.* : //dl-cdn.alpinelinux.org/alpine# ${ ALPINE_REPO_URL } #g " /etc/apk/repositories ; fi
2023-02-22 04:13:11 -06:00
RUN apk add --no-cache curl jq bash coreutils
2025-09-05 09:04:08 -07:00
COPY --from= powerman/dockerize:0.24 /usr/local/bin/dockerize /usr/local/bin
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
2024-01-22 11:46:04 -06:00
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