forked from apple/foundationdb
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from umpc/docker
A few potential improvement suggestions
- Loading branch information
Showing
3 changed files
with
51 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,44 @@ | ||
FROM ubuntu:18.04 | ||
|
||
ENV FDB_UID="1000" | ||
ENV FDB_GID="1000" | ||
|
||
ARG FDB_LISTEN_ADDR="0.0.0.0" | ||
|
||
ARG FDB_VERSION="5.1.7" | ||
ARG FDB_REVISION="1" | ||
ARG LISTEN_ADDR="0.0.0.0" | ||
ARG FDB_DEB_REVISION="1" | ||
|
||
ARG FDB_PKG_URL="https://www.foundationdb.org/downloads/${FDB_VERSION}/ubuntu/installers" | ||
ARG FDB_CLIENTS_PKG="foundationdb-clients_${FDB_VERSION}-${FDB_DEB_REVISION}_amd64.deb" | ||
ARG FDB_SERVER_PKG="foundationdb-server_${FDB_VERSION}-${FDB_DEB_REVISION}_amd64.deb" | ||
|
||
ADD https://www.foundationdb.org/downloads/"$FDB_VERSION"/ubuntu/installers/foundationdb-clients_"$FDB_VERSION"-"$FDB_REVISION"_amd64.deb /tmp/foundationdb-clients_"$FDB_VERSION"-"$FDB_REVISION"_amd64.deb | ||
ADD https://www.foundationdb.org/downloads/"$FDB_VERSION"/ubuntu/installers/foundationdb-server_"$FDB_VERSION"-"$FDB_REVISION"_amd64.deb /tmp/foundationdb-server_"$FDB_VERSION"-"$FDB_REVISION"_amd64.deb | ||
ADD ${FDB_PKG_URL}/${FDB_CLIENTS_PKG} /tmp/${FDB_CLIENTS_PKG} | ||
ADD ${FDB_PKG_URL}/${FDB_SERVER_PKG} /tmp/${FDB_SERVER_PKG} | ||
|
||
RUN apt update &&\ | ||
RUN apt update && \ | ||
apt install -y python | ||
RUN dpkg -i /tmp/foundationdb-clients_*_amd64.deb &&\ | ||
dpkg -i /tmp/foundationdb-server_*_amd64.deb &&\ | ||
service foundationdb stop &&\ | ||
rm -rf /tmp/foundationdb-*_"$FDB_VERSION"-"$FDB_REVISION"_amd64.deb /var/lib/foundationdb/data/* | ||
RUN sed -i "s/^listen_address.*/listen_address = $LISTEN_ADDR:4500/" /etc/foundationdb/foundationdb.conf &&\ | ||
cp -r /etc/foundationdb /etc/foundationdb.default | ||
|
||
CMD cp --no-clobber /etc/foundationdb.default/* /etc/foundationdb &&\ | ||
chown -R foundationdb:foundationdb /etc/foundationdb &&\ | ||
/usr/lib/foundationdb/fdbmonitor | ||
|
||
EXPOSE 4500 | ||
RUN dpkg -i /tmp/${FDB_CLIENTS_PKG} /tmp/${FDB_SERVER_PKG} && \ | ||
rm /tmp/${FDB_CLIENTS_PKG} /tmp/${FDB_SERVER_PKG} | ||
|
||
# Note: Remove this instruction if deb postinst is changed to not auto-start foundationdb. | ||
RUN service foundationdb stop && \ | ||
rm -rf /var/lib/foundationdb/data/* | ||
|
||
# Replace the default listen_address with 0.0.0.0 or an argument specified at build time. | ||
RUN sed -i "s/^listen_address.*/listen_address = ${FDB_LISTEN_ADDR}:4500/" /etc/foundationdb/foundationdb.conf | ||
|
||
# Keeps the default configuration from being overlaid by bind mounts. | ||
RUN cp -r /etc/foundationdb /etc/foundationdb.default | ||
|
||
# Writes the default configuration to bind mounts if not present. | ||
CMD cp -r --no-clobber /etc/foundationdb.default/* /etc/foundationdb && \ | ||
# Syncs host and container file ownership for privilege separation. | ||
groupmod -g ${FDB_GID} foundationdb && \ | ||
usermod -g ${FDB_GID} -u ${FDB_UID} --non-unique foundationdb && \ | ||
chown -R foundationdb:foundationdb \ | ||
/etc/foundationdb \ | ||
/var/log/foundationdb \ | ||
/var/lib/foundationdb && \ | ||
# Starts foundationdb | ||
/usr/lib/foundationdb/fdbmonitor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters