2024-05-08 16:18:49 +02:00
|
|
|
FROM --platform=$BUILDPLATFORM golang:1.22-alpine3.18 as builder
|
2024-04-28 00:08:51 +02:00
|
|
|
|
|
|
|
RUN apk add --no-cache -U \
|
|
|
|
libc-dev curl nodejs npm git gcc zip unzip tar
|
|
|
|
|
|
|
|
WORKDIR /usr/local
|
|
|
|
# hadolint ignore=DL4006
|
|
|
|
RUN curl -sL https://taskfile.dev/install.sh | sh
|
|
|
|
|
|
|
|
WORKDIR /go/src/semaphore
|
2024-04-28 14:48:38 +02:00
|
|
|
COPY go.mod go.sum /go/src/semaphore/
|
|
|
|
|
|
|
|
RUN --mount=type=cache,target=/go/pkg \
|
|
|
|
go mod download -x
|
|
|
|
|
|
|
|
COPY . /go/src/semaphore
|
2024-04-28 00:08:51 +02:00
|
|
|
|
|
|
|
ARG TARGETOS
|
|
|
|
ARG TARGETARCH
|
|
|
|
|
2024-05-21 21:27:19 +02:00
|
|
|
RUN --mount=type=cache,target=/go/pkg \
|
|
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
2024-05-21 22:04:56 +02:00
|
|
|
task deps && \
|
2024-04-28 01:00:30 +02:00
|
|
|
task build GOOS=${TARGETOS} GOARCH=${TARGETARCH}
|
2024-04-28 00:08:51 +02:00
|
|
|
|
|
|
|
FROM alpine:3.19
|
|
|
|
|
|
|
|
RUN apk add --no-cache -U \
|
2024-05-04 01:49:31 +02:00
|
|
|
bash curl git gnupg mysql-client openssh-client-default python3 python3-dev py3-pip rsync sshpass tar tini tzdata unzip wget zip build-base openssl-dev libffi-dev cargo && \
|
2024-04-28 00:08:51 +02:00
|
|
|
rm -rf /var/cache/apk/* && \
|
|
|
|
adduser -D -u 1001 -G root semaphore && \
|
|
|
|
mkdir -p /tmp/semaphore && \
|
|
|
|
mkdir -p /etc/semaphore && \
|
|
|
|
mkdir -p /var/lib/semaphore && \
|
2024-05-28 00:45:25 +02:00
|
|
|
mkdir -p /opt/semaphore && \
|
2024-04-28 00:08:51 +02:00
|
|
|
chown -R semaphore:0 /tmp/semaphore && \
|
|
|
|
chown -R semaphore:0 /etc/semaphore && \
|
2024-05-28 00:45:25 +02:00
|
|
|
chown -R semaphore:0 /var/lib/semaphore && \
|
|
|
|
chown -R semaphore:0 /opt/semaphore
|
2024-04-28 00:08:51 +02:00
|
|
|
|
|
|
|
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/
|
|
|
|
COPY --from=builder /go/src/semaphore/bin/semaphore /usr/local/bin/
|
|
|
|
|
|
|
|
RUN chown -R semaphore:0 /usr/local/bin/server-wrapper && \
|
|
|
|
chmod +x /usr/local/bin/server-wrapper && \
|
|
|
|
chown -R semaphore:0 /usr/local/bin/semaphore && \
|
|
|
|
chmod +x /usr/local/bin/semaphore
|
|
|
|
|
|
|
|
WORKDIR /home/semaphore
|
|
|
|
USER 1001
|
|
|
|
|
|
|
|
# renovate: datasource=pypi depName=ansible
|
|
|
|
ENV ANSIBLE_VERSION 9.4.0
|
|
|
|
|
2024-06-05 10:28:32 +02:00
|
|
|
RUN mkdir /opt/semaphore/venv && \
|
|
|
|
python3 -m venv /opt/semaphore/venv --system-site-packages && \
|
2024-05-28 00:45:25 +02:00
|
|
|
source /opt/semaphore/venv/bin/activate && \
|
2024-05-21 21:27:19 +02:00
|
|
|
pip3 install --upgrade pip ansible==${ANSIBLE_VERSION} boto3 botocore requests
|
2024-04-28 00:08:51 +02:00
|
|
|
|
2024-05-29 23:24:03 +02:00
|
|
|
# Preventing ansible zombie processes. Tini kills zombies.
|
|
|
|
ENTRYPOINT ["/sbin/tini", "--"]
|
2024-04-28 00:08:51 +02:00
|
|
|
CMD [ "/usr/local/bin/server-wrapper"]
|