-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker: data dir & user permissions, install ca-certificates, better …
…data dir location, more. (#58) Improvements to the docker container and associated utilities.
- Loading branch information
Showing
6 changed files
with
68 additions
and
19 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
# This dockerfile is used by goreleaser | ||
# Build this Dockerfile with goreleaser. | ||
# The binary must be present at /conduit | ||
FROM debian:bullseye-slim | ||
|
||
RUN useradd conduit | ||
RUN mkdir -p /conduit/data && \ | ||
chown -R conduit.conduit /conduit | ||
# Hard code UID/GID to 999 for consistency in advanced deployments. | ||
# Install ca-certificates to enable using infra providers. | ||
# Install gosu for fancy data directory management. | ||
RUN groupadd --gid=999 --system algorand && \ | ||
useradd --uid=999 --no-log-init --create-home --system --gid algorand algorand && \ | ||
mkdir -p /data && \ | ||
chown -R algorand.algorand /data && \ | ||
apt-get update && \ | ||
apt-get install -y gosu ca-certificates && \ | ||
update-ca-certificates && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# binary is passed into the build | ||
COPY conduit /conduit/conduit | ||
COPY conduit /usr/local/bin/conduit | ||
COPY docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh | ||
|
||
USER conduit | ||
WORKDIR /conduit | ||
ENTRYPOINT ["./conduit"] | ||
CMD ["-d", "data"] | ||
ENV CONDUIT_DATA_DIR /data | ||
WORKDIR /data | ||
# Note: docker-entrypoint.sh calls 'conduit'. Similar entrypoint scripts | ||
# accept the binary as the first argument in order to surface a suite of | ||
# tools (i.e. algod, goal, algocfg, ...). Maybe this will change in the | ||
# future, but for now this approach seemed simpler. | ||
ENTRYPOINT ["docker-entrypoint.sh"] |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# To allow mounting the data directory we need to change permissions | ||
# to our algorand user. The script is initially run as the root user | ||
# in order to change permissions; afterwards, the script is re-launched | ||
# as the algorand user. | ||
if [ "$(id -u)" = '0' ]; then | ||
chown -R algorand:algorand $CONDUIT_DATA_DIR | ||
exec gosu algorand "$0" "$@" | ||
fi | ||
|
||
# always run the conduit command | ||
exec conduit "$@" |
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