fix(docker): create /var/lib/semaphore dir

This commit is contained in:
Denis Gukov 2022-10-06 12:35:31 +05:00
parent 1852ae627e
commit a881f3f5a3
6 changed files with 11 additions and 88 deletions

View File

@ -17,9 +17,11 @@ RUN adduser -D -u 1002 -g 0 semaphore && \
mkdir -p /go/src/github.com/ansible-semaphore/semaphore && \
mkdir -p /tmp/semaphore && \
mkdir -p /etc/semaphore && \
mkdir -p /var/lib/semaphore && \
chown -R semaphore:0 /go && \
chown -R semaphore:0 /tmp/semaphore && \
chown -R semaphore:0 /etc/semaphore && \
chown -R semaphore:0 /var/lib/semaphore && \
ssh-keygen -t rsa -q -f "/root/.ssh/id_rsa" -N "" && \
ssh-keyscan -H github.com > /root/.ssh/known_hosts

View File

@ -1,54 +0,0 @@
Bootstrap: docker
From: golang:1.18.3-alpine3.16
Stage: spython-base
%setup
mkdir $SINGULARITY_ROOTFS/bigdata
%post
SEMAPHORE_VERSION="development"
SEMAPHORE_ARCH="linux_amd64"
SEMAPHORE_CONFIG_PATH="${SEMAPHORE_CONFIG_PATH:-/etc/semaphore}"
APP_ROOT="/mnt/"
# hadolint ignore=DL3013
apk add --no-cache sshpass git mysql-client python3 py3-pip py-openssl openssl ca-certificates curl curl-dev openssh-client-default tini nodejs npm bash rsync && \
apk --update add --virtual build-dependencies python3-dev libffi-dev openssl-dev build-base &&\
rm -rf /var/cache/apk/*
pip3 install --upgrade pip cffi && \
pip3 install ansible &&\
apk del build-dependencies
adduser -D -u 1002 -g 0 semaphore && \
mkdir -p $APP_ROOT && \
mkdir -p /tmp/semaphore && \
mkdir -p /etc/semaphore && \
chown -R semaphore:0 /go && \
chown -R semaphore:0 /tmp/semaphore && \
chown -R semaphore:0 /etc/semaphore && \
ssh-keygen -t rsa -q -f "/root/.ssh/id_rsa" -N "" && \
ssh-keyscan -H github.com > /root/.ssh/known_hosts
cd $(go env GOPATH) && curl -sL https://taskfile.dev/install.sh | sh
# Copy in app source
cd ${APP_ROOT}
./deployment/docker/ci/bin/install
su - semaphore # USER semaphore
# EXPOSE 3000
%environment
export SEMAPHORE_VERSION="development"
export SEMAPHORE_ARCH="linux_amd64"
export SEMAPHORE_CONFIG_PATH="${SEMAPHORE_CONFIG_PATH:-/etc/semaphore}"
export APP_ROOT="/mnt/"
%runscript
cd ${APP_ROOT}
exec /usr/local/bin/semaphore-wrapper ./bin/semaphore server --config /etc/semaphore/config.json "$@"
%startscript
cd ${APP_ROOT}
exec /usr/local/bin/semaphore-wrapper ./bin/semaphore server --config /etc/semaphore/config.json "$@"

View File

@ -1,29 +0,0 @@
#!/bin/bash -l
# Set env
SUSER=$USER
SCRIPT_HOME=$(realpath $(dirname $0))
SEMAPHORE_HOME=$(realpath $SCRIPT_HOME/../../../../)
echo "Building in $SEMAPHORE_HOME"
if [[ ! -f $SCRIPT_HOME/../semaphore.simg ]]; then
# Build Image
sudo bash -lc "
# Set env
module purge
module load singularity || echo 'Not using modules'
export SINGULARITY_BIND=${SEMAPHORE_HOME}:/mnt
# Build image
cd $SCRIPT_HOME/../ && singularity build semaphore.simg Singularity
# Update perms
chmod -R ${SUSER}: $SEMAPHORE_HOME"
else
# Build RPM
module load singularity || echo 'Not using modules'
cd ${SEMAPHORE_HOME} && singularity exec $SCRIPT_HOME/../semaphore.simg task release
chmod a+rx ${SEMAPHORE_HOME}/bin
chmod a+r ${SEMAPHORE_HOME}/bin/*
fi

View File

@ -43,13 +43,13 @@ export SEMAPHORE_ACCESS_KEY_ENCRYPTION="${SEMAPHORE_ACCESS_KEY_ENCRYPTION:-cFcXI
exit 1
}
[ -d "${SEMAPHORE_DB_PATH}" ] || mkdir -p "${SEMAPHORE_DB_PATH}" || {
echo "Can't create BoltDB path ${SEMAPHORE_DB_PATH}."
[ -d "${SEMAPHORE_CONFIG_PATH}" ] || mkdir -p "${SEMAPHORE_CONFIG_PATH}" || {
echo "Can't create Semaphore Config path ${SEMAPHORE_CONFIG_PATH}."
exit 1
}
[ -d "${SEMAPHORE_CONFIG_PATH}" ] || mkdir -p "${SEMAPHORE_CONFIG_PATH}" || {
echo "Can't create Semaphore Config path ${SEMAPHORE_CONFIG_PATH}."
[ -d "${SEMAPHORE_DB_PATH}" ] || mkdir -p "${SEMAPHORE_DB_PATH}" || {
echo "Can't create data path ${SEMAPHORE_DB_PATH}."
exit 1
}

View File

@ -17,9 +17,11 @@ RUN adduser -D -u 1002 -g 0 semaphore && \
mkdir -p /go/src/github.com/ansible-semaphore/semaphore && \
mkdir -p /tmp/semaphore && \
mkdir -p /etc/semaphore && \
mkdir -p /var/lib/semaphore && \
chown -R semaphore:0 /go && \
chown -R semaphore:0 /tmp/semaphore && \
chown -R semaphore:0 /etc/semaphore && \
chown -R semaphore:0 /var/lib/semaphore && \
ssh-keygen -t rsa -q -f "/root/.ssh/id_rsa" -N "" && \
ssh-keyscan -H github.com > /root/.ssh/known_hosts

View File

@ -17,8 +17,10 @@ RUN apk add --no-cache sshpass git curl ansible mysql-client openssh-client-defa
adduser -D -u 1001 -G root semaphore && \
mkdir -p /tmp/semaphore && \
mkdir -p /etc/semaphore && \
mkdir -p /var/lib/semaphore && \
chown -R semaphore:0 /tmp/semaphore && \
chown -R semaphore:0 /etc/semaphore
chown -R semaphore:0 /etc/semaphore && \
chown -R semaphore:0 /var/lib/semaphore
COPY --from=builder /usr/local/bin/semaphore-wrapper /usr/local/bin/
COPY --from=builder /usr/local/bin/semaphore /usr/local/bin/