generated from cybozu-go/neco-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
56 lines (44 loc) · 2.06 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
FROM ghcr.io/cybozu/golang:1.23-jammy AS builder
WORKDIR /workspace
COPY . .
RUN make build
FROM ghcr.io/cybozu/ubuntu:22.04 AS controller
LABEL org.opencontainers.image.source="https://github.com/cybozu-go/meows"
COPY --from=builder /workspace/tmp/bin/controller /usr/local/bin
COPY --from=builder /workspace/tmp/bin/slack-agent /usr/local/bin
COPY --from=builder /workspace/tmp/bin/meows /usr/local/bin
USER 10000:10000
ENTRYPOINT ["controller"]
FROM ghcr.io/cybozu/ubuntu:22.04 AS runner
LABEL org.opencontainers.image.source="https://github.com/cybozu-go/meows"
# Even if the version of the runner is out of date, it will self-update at job execution time. So there is no problem to update it when you notice.
# TODO: Until https://github.com/cybozu-go/meows/issues/137 is fixed, update it manually.
ARG RUNNER_VERSION=2.320.0
ENV DEBIAN_FRONTEND=noninteractive
# hadolint ignore=DL3015
RUN apt-get update -y \
&& apt-get install -y software-properties-common \
&& add-apt-repository -y ppa:git-core/ppa \
&& apt-get update -y \
&& apt-get install -y --no-install-recommends libyaml-dev \
&& rm -rf /var/lib/apt/lists/*
ARG RUNNER_ASSETS_DIR=/runner
RUN mkdir -p ${RUNNER_ASSETS_DIR} \
&& cd ${RUNNER_ASSETS_DIR} \
&& curl -L -O https://raw.githubusercontent.com/actions/runner/${RUNNER_VERSION}/LICENSE \
&& curl -L -o runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \
&& tar xzf ./runner.tar.gz \
&& rm runner.tar.gz \
&& ./bin/installdependencies.sh \
&& chown -R 10000 ${RUNNER_ASSETS_DIR}
ENV AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
RUN mkdir -p ${AGENT_TOOLSDIRECTORY} \
&& chmod g+rwx ${AGENT_TOOLSDIRECTORY}
USER 10000
COPY scripts/job-cancelled /usr/local/bin
COPY scripts/job-failure /usr/local/bin
COPY scripts/job-success /usr/local/bin
COPY --from=builder /workspace/tmp/bin/meows /usr/local/bin
COPY --from=builder /workspace/tmp/bin/job-started /usr/local/bin
COPY --from=builder /workspace/tmp/bin/entrypoint /usr/local/bin
CMD ["/usr/local/bin/entrypoint"]