Skip to content

Commit d2ab89c

Browse files
committed
Update docker files to enable all access to TEST_USER
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
1 parent 07f5f93 commit d2ab89c

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ FROM ubuntu:${UBUNTU_VERSION}
4747

4848
COPY --from=builder /go/bin/cosmovisor /usr/bin/
4949

50-
RUN apt-get update && apt-get install -y adduser ca-certificates && update-ca-certificates
50+
RUN apt-get update && apt-get install -y adduser ca-certificates sudo && update-ca-certificates
5151

5252
# test user
5353
ARG TEST_USER
@@ -60,12 +60,17 @@ ARG TEST_UID
6060
ENV TEST_UID=${TEST_UID:-900}
6161
#ARG gid=1000
6262
RUN adduser --disabled-password --uid ${TEST_UID} --home /var/lib/${TEST_USER} --gecos 'DCLedger user' ${TEST_USER}
63+
RUN usermod -aG sudo ${TEST_USER} \
64+
&& echo "${TEST_USER} ALL=(ALL:ALL) NOPASSWD:ALL" >>/etc/sudoers
65+
6366
ENV DAEMON_HOME=/var/lib/${TEST_USER}/.dcl
6467
ENV DAEMON_NAME=dcld
6568
ENV DAEMON_ALLOW_DOWNLOAD_BINARIES=true
6669
ENV COSMOVISOR_CUSTOM_PREUPGRADE=cosmovisor_preupgrade.sh
6770
ENV GOCOVERDIR=/var/lib/${TEST_USER}/.dcl/gocover
6871

72+
RUN mkdir -p /var/lib/${TEST_USER} && chown -R ${TEST_USER}:${TEST_USER} /var/lib/${TEST_USER}
73+
6974
VOLUME /var/lib/${TEST_USER}
7075

7176
EXPOSE 26656 26657 1317 26660 8888
@@ -74,9 +79,9 @@ STOPSIGNAL SIGTERM
7479

7580
USER ${TEST_USER}
7681

77-
COPY integration_tests/node_helper.sh /var/lib/${TEST_USER}/
78-
COPY deployment/ansible/roles/bootstrap/files/cosmovisor_start.sh /var/lib/${TEST_USER}/
79-
COPY deployment/ansible/roles/bootstrap/files/cosmovisor_preupgrade.sh /var/lib/${TEST_USER}/
82+
COPY --chown=${TEST_USER}:${TEST_USER} integration_tests/node_helper.sh /var/lib/${TEST_USER}/
83+
COPY --chown=${TEST_USER}:${TEST_USER} deployment/ansible/roles/bootstrap/files/cosmovisor_start.sh /var/lib/${TEST_USER}/
84+
COPY --chown=${TEST_USER}:${TEST_USER} deployment/ansible/roles/bootstrap/files/cosmovisor_preupgrade.sh /var/lib/${TEST_USER}/
8085

8186
ENV PATH=$PATH:${DAEMON_HOME}/cosmovisor/current/bin
8287

integration_tests/deploy/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ RUN adduser --disabled-password --uid ${TEST_UID} --home /var/lib/${TEST_USER} -
4141
RUN usermod -aG sudo ${TEST_USER} \
4242
&& echo "${TEST_USER} ALL=(ALL:ALL) NOPASSWD:ALL" >>/etc/sudoers
4343

44+
RUN mkdir -p /var/lib/${TEST_USER} && chown -R ${TEST_USER}:${TEST_USER} /var/lib/${TEST_USER}
45+
4446
EXPOSE 26656 26657 1317 26660
4547

4648
# USER ${TEST_USER}

integration_tests/node_helper.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ restart_cnt=0
2323

2424
RUN_CMD="$HOME"/./cosmovisor_start.sh
2525
rm -f "$HOME"/.dcl/cosmovisor/cosmovisor_preupgrade.sh
26-
ln -s "$HOME"/cosmovisor_preupgrade.sh "$HOME"/.dcl/cosmovisor/cosmovisor_preupgrade.sh
26+
sudo ln -s "$HOME"/cosmovisor_preupgrade.sh "$HOME"/.dcl/cosmovisor/cosmovisor_preupgrade.sh
2727

2828
cosmovisor_stop() {
2929
pkill -f cosmovisor_start

0 commit comments

Comments
 (0)