update alpine entry point

This commit is contained in:
ILoveYaToo 2020-04-18 16:08:00 -04:00
parent 4de51d7285
commit 0f3dbe9963
3 changed files with 16 additions and 17 deletions

View File

@ -1,9 +1,11 @@
FROM ruby:2.6-alpine FROM ruby:2.6-alpine
ENV DOCKERIZE_VERSION v0.6.1
RUN wget https://github.com/wrouesnel/p2cli/releases/download/r5/p2 -O /usr/local/bin/p2 \ RUN wget https://github.com/wrouesnel/p2cli/releases/download/r5/p2 -O /usr/local/bin/p2 \
&& chmod +x /usr/local/bin/p2 && chmod +x /usr/local/bin/p2
RUN apk --no-cache add nodejs mariadb-client git bash libcap build-base mariadb-dev tzdata mariadb-connector-c \ RUN apk --no-cache add nodejs mariadb-client git bash libcap build-base mariadb-dev tzdata mariadb-connector-c openssl \
&& git clone https://github.com/atech/postal.git /opt/postal \ && git clone https://github.com/atech/postal.git /opt/postal \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& gem install bundler \ && gem install bundler \
@ -16,6 +18,11 @@ RUN apk --no-cache add nodejs mariadb-client git bash libcap build-base mariadb-
&& apk del git mariadb-dev \ && apk del git mariadb-dev \
&& rm -rf /var/cache/apk/* && rm -rf /var/cache/apk/*
## Install jwilder/dockerize
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
## Adjust permissions ## Adjust permissions
RUN setcap 'cap_net_bind_service=+ep' /usr/local/bin/ruby RUN setcap 'cap_net_bind_service=+ep' /usr/local/bin/ruby

View File

@ -13,14 +13,9 @@ if [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/postal.
echo " secret_key: {{secretkey}}" >> /opt/postal/config/postal.example.yml echo " secret_key: {{secretkey}}" >> /opt/postal/config/postal.example.yml
## Generate config and keys ## Generate config and keys
/opt/postal/bin/postal initialize-config /opt/postal/bin/postal initialize-config
## Wait for MySQL to start up ## Wait for MySQL and RabbitMQ to start up
echo "== Waiting for MySQL to start up ==" echo "== Waiting for MySQL and RabbitMQ to start up =="
while ! mysqladmin ping -h mysql --silent; do dockerize -wait tcp://mysql:3306 -wait http://rabbitmq:5672/api/aliveness-test
sleep 0.5
done
while ! mysql -hmysql -u root -p"$MYSQL_ROOT_PASSWORD" -e "use $MYSQL_DATABASE" 2> /dev/null; do
sleep 0.5
done
/opt/postal/bin/postal initialize /opt/postal/bin/postal initialize
/opt/postal/bin/postal make-user <<-EOF /opt/postal/bin/postal make-user <<-EOF
$POSTAL_EMAIL $POSTAL_EMAIL
@ -29,14 +24,9 @@ $POSTAL_LNAME
$POSTAL_PASSWORD $POSTAL_PASSWORD
EOF EOF
else else
## Wait for MySQL to start up ## Wait for MySQL and RabbitMQ to start up
echo "== Waiting for MySQL to start up ==" echo "== Waiting for MySQL and RabbitMQ to start up =="
while ! mysqladmin ping -h mysql --silent; do dockerize -wait tcp://mysql:3306 -wait http://rabbitmq:5672/api/aliveness-test
sleep 0.5
done
while ! mysql -hmysql -u root -p"$MYSQL_ROOT_PASSWORD" -e "use $MYSQL_DATABASE" 2> /dev/null; do
sleep 0.5
done
fi fi
## Start Postal ## Start Postal
/opt/postal/bin/postal "$@" /opt/postal/bin/postal "$@"

View File

@ -1,4 +1,5 @@
FROM ruby:2.6 FROM ruby:2.6
ENV DOCKERIZE_VERSION v0.6.1 ENV DOCKERIZE_VERSION v0.6.1
RUN curl -L https://github.com/wrouesnel/p2cli/releases/download/r5/p2 -o /usr/local/bin/p2 \ RUN curl -L https://github.com/wrouesnel/p2cli/releases/download/r5/p2 -o /usr/local/bin/p2 \
@ -21,6 +22,7 @@ RUN apt-get -y update \
&& apt-get -y autoremove \ && apt-get -y autoremove \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
## Install jwilder/dockerize
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ && tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz