Skip to content

Commit 0452646

Browse files
committed
chore(helmbroker): change uid gid to 1001
1 parent 638773b commit 0452646

6 files changed

Lines changed: 45 additions & 48 deletions

File tree

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ full-clean: check-docker
4949
test: test-style test-unit test-functional
5050

5151
test-style: docker-build-test
52-
docker run --rm -v ${CURDIR}:/test -w /test/rootfs ${IMAGE}.test /test/rootfs/bin/test-style
52+
$(shell chown -R 1001:1001 ${CURDIR})
53+
docker run --rm -v ${CURDIR}:/tmp/test -w /tmp/test/rootfs ${IMAGE}.test /tmp/test/rootfs/bin/test-style
5354
${SHELLCHECK_PREFIX} $(SHELL_SCRIPTS)
5455

5556
test-unit: docker-build-test
@@ -63,6 +64,6 @@ test-integration:
6364

6465
upload-coverage:
6566
$(eval CI_ENV := $(shell curl -s https://codecov.io/env | bash))
66-
docker run --rm ${CI_ENV} -v ${CURDIR}:/test -w /test/rootfs ${IMAGE}.test /test/rootfs/bin/upload-coverage
67+
docker run --rm ${CI_ENV} -v ${CURDIR}:/tmp/test -w /tmp/test/rootfs ${IMAGE}.test /tmp/test/rootfs/bin/upload-coverage
6768

6869
.PHONY: check-kubectl check-docker build docker-build docker-build-test deploy clean commit-hook full-clean test test-style test-unit test-functional test-integration upload-coverage

charts/helmbroker/templates/helmbroker-celery.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ spec:
2626
- name: drycc-helmbroker-celery
2727
image: {{.Values.imageRegistry}}/{{.Values.imageOrg}}/helmbroker:{{.Values.imageTag}}
2828
imagePullPolicy: {{.Values.imagePullPolicy}}
29-
command:
30-
- /bin/bash
31-
- -c
3229
args:
33-
- celery -A helmbroker worker --autoscale=32,1 --loglevel=info
30+
- /bin/bash
31+
- -c
32+
- celery -A helmbroker worker --autoscale=32,1 --loglevel=info
3433
{{- include "helmbroker.limits" . | indent 10 }}
3534
{{- include "helmbroker.envs" . | indent 10 }}
3635
{{- include "helmbroker.volumeMounts" . | indent 10 }}

charts/helmbroker/templates/helmbroker-cronjob-daily.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ spec:
2121
- image: {{.Values.imageRegistry}}/{{.Values.imageOrg}}/helmbroker:{{.Values.imageTag}}
2222
imagePullPolicy: {{.Values.imagePullPolicy}}
2323
name: drycc-helmbroker-cleaner
24-
command:
25-
- /bin/bash
26-
- -c
2724
args:
28-
- python -m helmbroker.cleaner
25+
- /bin/bash
26+
- -c
27+
- python -m helmbroker.cleaner
2928
{{- include "helmbroker.envs" . | indent 12 }}
3029
{{- include "helmbroker.volumeMounts" . | indent 12 }}
3130
{{- include "helmbroker.volumes" . | indent 10 }}

charts/helmbroker/templates/helmbroker-deployment.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ spec:
2626
- name: loader
2727
image: {{.Values.imageRegistry}}/{{.Values.imageOrg}}/helmbroker:{{.Values.imageTag}}
2828
imagePullPolicy: {{.Values.imagePullPolicy}}
29-
command:
30-
- /bin/bash
31-
- -c
3229
args:
33-
- python -m helmbroker.loader
30+
- /bin/bash
31+
- -c
32+
- python -m helmbroker.loader
3433
{{- include "helmbroker.envs" . | indent 10 }}
3534
{{- include "helmbroker.volumeMounts" . | indent 10 }}
3635
containers:

rootfs/Dockerfile

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
FROM docker.io/drycc/base:bullseye
22

3-
RUN adduser --system \
4-
--shell /bin/bash \
5-
--disabled-password \
6-
--home /workspace \
7-
--group \
8-
drycc
3+
ARG DRYCC_UID=1001
4+
ARG DRYCC_GID=1001
5+
ARG DRYCC_HOME_DIR=/workspace
6+
7+
RUN groupadd drycc --gid ${DRYCC_GID} \
8+
&& useradd drycc -u ${DRYCC_UID} -g ${DRYCC_GID} -s /bin/bash -m -d ${DRYCC_HOME_DIR}
99

1010
ENV PYTHON_VERSION="3.10.2" \
1111
HELM_VERSION="3.8.0"
1212

13-
COPY . /workspace
13+
COPY . ${DRYCC_HOME_DIR}
1414

15-
WORKDIR /workspace
15+
WORKDIR ${DRYCC_HOME_DIR}
1616
RUN buildDeps='musl-dev openssl' \
1717
&& install-packages $buildDeps \
1818
&& install-stack python $PYTHON_VERSION \
1919
&& install-stack helm $HELM_VERSION && . init-stack \
20-
&& python3 -m venv /workspace/.venv \
21-
&& source /workspace/.venv/bin/activate \
22-
&& pip3 install --disable-pip-version-check --no-cache-dir -r /workspace/requirements.txt \
23-
&& chown -R drycc:drycc /workspace \
20+
&& python3 -m venv ${DRYCC_HOME_DIR}/.venv \
21+
&& source ${DRYCC_HOME_DIR}/.venv/bin/activate \
22+
&& pip3 install --disable-pip-version-check --no-cache-dir -r ${DRYCC_HOME_DIR}/requirements.txt \
23+
&& chown -R drycc:drycc ${DRYCC_HOME_DIR} \
2424
# set env
25-
&& echo "source /workspace/.venv/bin/activate" >> /opt/drycc/python/profile.d/python.sh \
25+
&& echo "source ${DRYCC_HOME_DIR}/.venv/bin/activate" >> /opt/drycc/python/profile.d/python.sh \
2626
# cleanup
27-
&& scanelp /workspace/.venv/lib > runtime.txt \
27+
&& scanelp ${DRYCC_HOME_DIR}/.venv/lib > runtime.txt \
2828
&& apt-get purge -y --auto-remove $buildDeps \
2929
&& install-packages $(< runtime.txt) \
3030
&& apt-get autoremove -y \
@@ -45,6 +45,6 @@ RUN buildDeps='musl-dev openssl' \
4545
&& mkdir -p /usr/share/man/man{1..8}
4646

4747
USER drycc
48-
WORKDIR /workspace
49-
CMD ["/workspace/bin/boot"]
48+
WORKDIR ${DRYCC_HOME_DIR}
49+
CMD ["bin/boot"]
5050
EXPOSE 8000

rootfs/Dockerfile.test

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
11
FROM docker.io/drycc/base:bullseye
22

3-
RUN adduser --system \
4-
--shell /bin/bash \
5-
--disabled-password \
6-
--home /workspace \
7-
--group \
8-
drycc
3+
ARG DRYCC_UID=1001
4+
ARG DRYCC_GID=1001
5+
ARG DRYCC_HOME_DIR=/workspace
96

7+
RUN groupadd drycc --gid ${DRYCC_GID} \
8+
&& useradd drycc -u ${DRYCC_UID} -g ${DRYCC_GID} -s /bin/bash -m -d ${DRYCC_HOME_DIR}
109
ENV PYTHON_VERSION="3.10.2" \
1110
HELM_VERSION="3.8.0" \
1211
KUBECTL_VERSION="1.23.4"
1312

14-
COPY . /workspace
15-
WORKDIR /workspace
13+
COPY . ${DRYCC_HOME_DIR}
14+
WORKDIR ${DRYCC_HOME_DIR}
1615

1716
RUN buildDeps='musl-dev openssl'; \
1817
install-packages $buildDeps \
1918
&& install-stack python $PYTHON_VERSION \
2019
&& install-stack helm $HELM_VERSION \
2120
&& install-stack kubectl $KUBECTL_VERSION && . init-stack \
22-
&& python3 -m venv /workspace/.venv \
23-
&& source /workspace/.venv/bin/activate \
24-
&& pip3 install --disable-pip-version-check --no-cache-dir -r /workspace/requirements.txt \
25-
&& pip3 install --disable-pip-version-check --no-cache-dir -r /workspace/dev_requirements.txt \
26-
&& chown -R drycc:drycc /workspace \
21+
&& python3 -m venv ${DRYCC_HOME_DIR}/.venv \
22+
&& source ${DRYCC_HOME_DIR}/.venv/bin/activate \
23+
&& pip3 install --disable-pip-version-check --no-cache-dir -r ${DRYCC_HOME_DIR}/requirements.txt \
24+
&& pip3 install --disable-pip-version-check --no-cache-dir -r ${DRYCC_HOME_DIR}/dev_requirements.txt \
25+
&& chown -R drycc:drycc ${DRYCC_HOME_DIR} \
2726
# set env
28-
&& echo "source /workspace/.venv/bin/activate" >> /opt/drycc/python/profile.d/python.sh \
27+
&& echo "source ${DRYCC_HOME_DIR}/.venv/bin/activate" >> /opt/drycc/python/profile.d/python.sh \
2928
# cleanup
30-
&& scanelp /workspace/.venv/lib > runtime.txt \
29+
&& scanelp ${DRYCC_HOME_DIR}/.venv/lib > runtime.txt \
3130
&& apt-get purge -y --auto-remove $buildDeps \
3231
&& install-packages $(< runtime.txt) \
3332
&& apt-get autoremove -y \
@@ -45,9 +44,9 @@ RUN buildDeps='musl-dev openssl'; \
4544
/lib/udev \
4645
/usr/lib/`echo $(uname -m)`-linux-gnu/gconv/IBM* \
4746
/usr/lib/`echo $(uname -m)`-linux-gnu/gconv/EBC* \
48-
&& mkdir -p /usr/share/man/man{1..8} \
47+
&& mkdir -p /usr/share/man/man{1..8}
4948

5049
USER drycc
51-
WORKDIR /workspace
52-
CMD ["/workspace/bin/boot"]
50+
WORKDIR ${DRYCC_HOME_DIR}
51+
CMD ["bin/boot"]
5352
EXPOSE 8000

0 commit comments

Comments
 (0)