Skip to content

Commit

Permalink
ci(docker): move venv from ~ to /opt
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftin committed May 27, 2024
1 parent fe3cc6c commit 6bbef06
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
10 changes: 6 additions & 4 deletions deployment/docker/runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ RUN apk add --no-cache -U \
mkdir -p /tmp/semaphore && \
mkdir -p /etc/semaphore && \
mkdir -p /var/lib/semaphore && \
mkdir -p /opt/semaphore && \
chown -R semaphore:0 /tmp/semaphore && \
chown -R semaphore:0 /etc/semaphore && \
chown -R semaphore:0 /var/lib/semaphore
chown -R semaphore:0 /var/lib/semaphore && \
chown -R semaphore:0 /opt/semaphore

COPY --chown=1001:0 ./deployment/docker/runner/ansible.cfg /tmp/semaphore/ansible.cfg
COPY --from=builder /go/src/semaphore/deployment/docker/runner/runner-wrapper /usr/local/bin/
Expand All @@ -51,10 +53,10 @@ USER 1001
# renovate: datasource=pypi depName=ansible
ENV ANSIBLE_VERSION 9.4.0

RUN mkdir ./venv
RUN mkdir /opt/semaphore/venv

RUN python3 -m venv ./venv --system-site-packages && \
source ./venv/bin/activate && \
RUN python3 -m venv /opt/semaphore/venv --system-site-packages && \
source /opt/semaphore/venv/bin/activate && \
pip3 install --upgrade pip ansible==${ANSIBLE_VERSION} boto3 botocore requests

CMD [ "/usr/local/bin/runner-wrapper"]
2 changes: 1 addition & 1 deletion deployment/docker/runner/runner-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export SEMAPHORE_CONFIG_PATH="${SEMAPHORE_CONFIG_PATH:-/etc/semaphore}"
export SEMAPHORE_TMP_PATH="${SEMAPHORE_TMP_PATH:-/tmp/semaphore}"
export ANSIBLE_CONFIG="${ANSIBLE_CONFIG:-${SEMAPHORE_TMP_PATH}/ansible.cfg}"

source /home/semaphore/venv/bin/activate
source /opt/semaphore/venv/bin/activate

if test -f "${SEMAPHORE_CONFIG_PATH}/packages.txt"; then
echoerr "Installing additional system dependencies"
Expand Down
10 changes: 6 additions & 4 deletions deployment/docker/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ bash curl git gnupg mysql-client openssh-client-default python3 python3-dev py3-
mkdir -p /tmp/semaphore && \
mkdir -p /etc/semaphore && \
mkdir -p /var/lib/semaphore && \
mkdir -p /opt/semaphore && \
chown -R semaphore:0 /tmp/semaphore && \
chown -R semaphore:0 /etc/semaphore && \
chown -R semaphore:0 /var/lib/semaphore
chown -R semaphore:0 /var/lib/semaphore && \
chown -R semaphore:0 /opt/semaphore

COPY --chown=1001:0 ./deployment/docker/server/ansible.cfg /tmp/semaphore/ansible.cfg
COPY --from=builder /go/src/semaphore/deployment/docker/server/server-wrapper /usr/local/bin/
Expand All @@ -51,10 +53,10 @@ USER 1001
# renovate: datasource=pypi depName=ansible
ENV ANSIBLE_VERSION 9.4.0

RUN mkdir ./venv
RUN mkdir /opt/semaphore/venv

RUN python3 -m venv ./venv --system-site-packages && \
source ./venv/bin/activate && \
RUN python3 -m venv /opt/semaphore/venv --system-site-packages && \
source /opt/semaphore/venv/bin/activate && \
pip3 install --upgrade pip ansible==${ANSIBLE_VERSION} boto3 botocore requests

CMD [ "/usr/local/bin/server-wrapper"]
2 changes: 1 addition & 1 deletion deployment/docker/server/server-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ EOF
fi
fi

source /home/semaphore/venv/bin/activate
source /opt/semaphore/venv/bin/activate

if test -f "${SEMAPHORE_CONFIG_PATH}/packages.txt"; then
echoerr "Installing additional system dependencies"
Expand Down
18 changes: 9 additions & 9 deletions web/src/components/InventoryForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@
:disabled="formSaving"
></v-select>

<v-text-field
v-model="item.inventory"
:label="$t('pathToInventoryFile')"
:rules="[v => !!v || $t('path_required')]"
required
:disabled="formSaving"
v-if="item.type === 'file'"
></v-text-field>

<v-select
v-model="item.repository_id"
:label="$t('repository') + ' (Optional)'"
Expand All @@ -62,15 +71,6 @@
v-if="item.type === 'file'"
></v-select>

<v-text-field
v-model="item.inventory"
:label="$t('pathToInventoryFile')"
:rules="[v => !!v || $t('path_required')]"
required
:disabled="formSaving"
v-if="item.type === 'file'"
></v-text-field>

<codemirror
:style="{ border: '1px solid lightgray' }"
v-model="item.inventory"
Expand Down

0 comments on commit 6bbef06

Please sign in to comment.