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
|
|
|
|
|
2024-12-20 15:59:07 -06:00
|
|
|
FROM golang:1-alpine3.21 AS binary
|
2023-01-23 10:25:33 +00:00
|
|
|
|
2023-11-28 21:52:11 +01:00
|
|
|
ARG ALPINE_REPO_URL
|
|
|
|
|
2025-04-21 16:39:26 -05:00
|
|
|
ENV DOCKERIZE_VERSION=v0.9.3
|
2023-01-23 10:25:33 +00:00
|
|
|
WORKDIR /go/src/github.com/jwilder
|
|
|
|
|
2023-11-28 21:52:11 +01:00
|
|
|
# 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-05-12 13:03:43 -04:00
|
|
|
# PFP-260: Upgrade Sqlite to >=3.28.0-r0 to fix https://security.snyk.io/vuln/SNYK-ALPINE39-SQLITE-449762
|
2025-04-21 16:39:26 -05:00
|
|
|
RUN apk --no-cache --update-cache --available upgrade \
|
|
|
|
&& apk --no-cache add 'c-ares>1.34.5' --repository=${ALPINE_REPO_URL}/edge/main \
|
|
|
|
&& apk --no-cache add openssl git tar curl sqlite
|
2023-01-23 10:25:33 +00:00
|
|
|
|
|
|
|
WORKDIR /go/src/github.com/jwilder/dockerize
|
|
|
|
|
|
|
|
RUN go install github.com/jwilder/dockerize@$DOCKERIZE_VERSION
|
|
|
|
|
2025-01-09 14:32:18 -06:00
|
|
|
FROM alpine:3.21 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
|
2023-01-23 10:25:33 +00:00
|
|
|
COPY --from=binary /go/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
|