Skip to content

Commit cfdf53f

Browse files
authored
Address DockerHub review (#454)
* Replace another `arch` with `apk --print-arch` * Don't `gosu` to influxdb user for non-influxd commands. * Use consistent test syntax.
1 parent 2c1aa43 commit cfdf53f

File tree

3 files changed

+29
-33
lines changed

3 files changed

+29
-33
lines changed

influxdb/2.0/alpine/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ RUN set -eux; \
3434

3535
ENV INFLUXDB_VERSION 2.0.4
3636
RUN set -eux && \
37-
ARCH=$(arch) && \
37+
ARCH="$(apk --print-arch)" && \
3838
if [ ${ARCH} = x86_64 ]; then \
3939
ARCH=amd64; \
4040
elif [ ${ARCH} = aarch64 ]; then \

influxdb/2.0/alpine/entrypoint.sh

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ function init_influxd () {
283283

284284
# Run influxd, with optional setup logic.
285285
function influxd_main () {
286-
if test -f "${BOLT_PATH}"; then
286+
if [ -f "${BOLT_PATH}" ]; then
287287
log info "found existing boltdb file, skipping setup wrapper" bolt_path "${BOLT_PATH}"
288288
elif [ -z "${INFLUXDB_INIT_MODE}" ]; then
289289
log warn "boltdb not found at configured path, but INFLUXDB_INIT_MODE not specified, skipping setup wrapper" bolt_path "${bolt_path}"
@@ -308,29 +308,27 @@ function main () {
308308
shift 1
309309
fi
310310

311-
if ${run_influxd}; then
312-
if [ "$1" = run ]; then
313-
shift 1
314-
fi
311+
if ! ${run_influxd}; then
312+
exec "${@}"
313+
fi
315314

316-
# Configure logging for our wrapper.
317-
set_global_log_level "${@}"
318-
# Configure data paths used across functions.
319-
set_data_paths "${@}"
320-
# Ensure volume directories exist w/ correct permissions.
321-
create_directories
315+
if [ "$1" = run ]; then
316+
shift 1
322317
fi
323318

319+
# Configure logging for our wrapper.
320+
set_global_log_level "${@}"
321+
# Configure data paths used across functions.
322+
set_data_paths "${@}"
323+
# Ensure volume directories exist w/ correct permissions.
324+
create_directories
325+
324326
if [ "$(id -u)" = 0 ]; then
325327
exec gosu influxdb "$0" "${@}"
326328
return
327329
fi
328330

329-
if ${run_influxd}; then
330-
influxd_main "${@}"
331-
else
332-
exec "${@}"
333-
fi
331+
influxd_main "${@}"
334332
}
335333

336334
main "${@}"

influxdb/2.0/entrypoint.sh

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ function init_influxd () {
274274

275275
# Run influxd, with optional setup logic.
276276
function influxd_main () {
277-
if test -f "${BOLT_PATH}"; then
277+
if [ -f "${BOLT_PATH}" ]; then
278278
log info "found existing boltdb file, skipping setup wrapper" bolt_path "${BOLT_PATH}"
279279
elif [ -z "${INFLUXDB_INIT_MODE}" ]; then
280280
log warn "boltdb not found at configured path, but INFLUXDB_INIT_MODE not specified, skipping setup wrapper" bolt_path "${bolt_path}"
@@ -299,29 +299,27 @@ function main () {
299299
shift 1
300300
fi
301301

302-
if ${run_influxd}; then
303-
if [ "$1" = run ]; then
304-
shift 1
305-
fi
302+
if ! ${run_influxd}; then
303+
exec "${@}"
304+
fi
306305

307-
# Configure logging for our wrapper.
308-
set_global_log_level "${@}"
309-
# Configure data paths used across functions.
310-
set_data_paths "${@}"
311-
# Ensure volume directories exist w/ correct permissions.
312-
create_directories
306+
if [ "$1" = run ]; then
307+
shift 1
313308
fi
314309

310+
# Configure logging for our wrapper.
311+
set_global_log_level "${@}"
312+
# Configure data paths used across functions.
313+
set_data_paths "${@}"
314+
# Ensure volume directories exist w/ correct permissions.
315+
create_directories
316+
315317
if [ "$(id -u)" = 0 ]; then
316318
exec gosu influxdb "$BASH_SOURCE" "${@}"
317319
return
318320
fi
319321

320-
if ${run_influxd}; then
321-
influxd_main "${@}"
322-
else
323-
exec "${@}"
324-
fi
322+
influxd_main "${@}"
325323
}
326324

327325
main "${@}"

0 commit comments

Comments
 (0)