Skip to content

Commit

Permalink
fix(docker): support non amd64 dockerize in setup containers (#7091)
Browse files Browse the repository at this point in the history
Co-authored-by: Pedro Silva <pedro@acryl.io>
  • Loading branch information
tonycsoka and pedro93 authored Jan 23, 2023
1 parent 54c5017 commit 1149cea
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
17 changes: 14 additions & 3 deletions docker/elasticsearch-setup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@
# Defining environment
ARG APP_ENV=prod

FROM alpine:3 AS base
FROM golang:1.17-alpine3.15 AS binary

ENV DOCKERIZE_VERSION v0.6.1
RUN apk add --no-cache curl jq tar bash coreutils \
&& curl -L https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz | tar -C /usr/local/bin -xzv
WORKDIR /go/src/github.com/jwilder

RUN apk --no-cache --update add openssl git tar curl

WORKDIR /go/src/github.com/jwilder/dockerize

RUN go install github.com/jwilder/dockerize@$DOCKERIZE_VERSION

FROM alpine:3 AS base
RUN apk add --no-cache curl jq tar bash coreutils
COPY --from=binary /go/bin/dockerize /usr/local/bin

FROM base AS prod-install

Expand All @@ -24,3 +34,4 @@ CMD if [ "$ELASTICSEARCH_USE_SSL" == "true" ]; then ELASTICSEARCH_PROTOCOL=https
&& 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

19 changes: 15 additions & 4 deletions docker/mysql-setup/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
FROM alpine:3
FROM golang:1.17-alpine3.15 AS binary

ENV DOCKERIZE_VERSION v0.6.1
RUN apk add --no-cache mysql-client curl tar bash \
&& curl -sSL https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz | tar -C /usr/local/bin -xzv
WORKDIR /go/src/github.com/jwilder

RUN apk --no-cache --update add openssl git tar curl

WORKDIR /go/src/github.com/jwilder/dockerize

RUN go install github.com/jwilder/dockerize@$DOCKERIZE_VERSION

FROM alpine:3
COPY --from=binary /go/bin/dockerize /usr/local/bin

RUN apk add --no-cache mysql-client curl tar bash

COPY docker/mysql-setup/init.sql /init.sql
COPY docker/mysql-setup/init.sh /init.sh
RUN chmod 755 init.sh

ENV DATAHUB_DB_NAME="datahub"

CMD dockerize -wait tcp://$MYSQL_HOST:$MYSQL_PORT -timeout 240s /init.sh
CMD dockerize -wait tcp://$MYSQL_HOST:$MYSQL_PORT -timeout 240s /init.sh

0 comments on commit 1149cea

Please sign in to comment.