forked from webdevops/go-crond
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.develop
70 lines (60 loc) · 2.52 KB
/
Dockerfile.develop
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
FROM golang:1.19-buster
# Install tools
RUN apt-get update \
&& apt-get -y -f dist-upgrade \
&& apt-get install -y -f \
build-essential \
vim \
nano \
git \
file \
&& apt-get install -y -f \
gcc-8-arm-linux-gnueabi \
gcc-arm-none-eabi \
gcc-arm-linux-gnueabi \
binutils-arm-linux-gnueabi \
g++-aarch64-linux-gnu \
&& ln -s /usr/include/asm-generic /usr/include/asm \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean -y
RUN useradd guest
RUN mkdir -p \
/etc/cron.d/ \
/etc/cron.daily/ \
/etc/cron.hourly/ \
/etc/cron.monthly/ \
/etc/cron.weekly/ \
&& echo -n > /etc/crontab \
&& echo 'SHELL=/bin/sh' >> /etc/crontab \
&& echo 'PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin' >> /etc/crontab \
&& echo '' >> /etc/crontab \
&& echo '# m h dom mon dow user command' >> /etc/crontab \
&& echo '17 * * * * root cd / && run-parts --report /etc/cron.hourly' >> /etc/crontab \
&& echo '25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )' >> /etc/crontab \
&& echo '47 6 * * 6 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )' >> /etc/crontab \
&& echo '52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )' >> /etc/crontab \
&& echo '* * * * * root date' >> /etc/crontab \
&& echo '' >> /etc/crontab
# Add some shell history
RUN set -x \
&& ln -sf /root/.ash_history /root/.bash_history \
&& echo go-crond -v root:examples/crontab-root guest:examples/crontab-guest >> /root/.ash_history \
&& echo go-crond -v examples/crontab-bad >> /root/.ash_history \
&& echo go-crond -v examples/crontab >> /root/.ash_history \
&& echo go-crond -v --run-parts-1min=guest:examples/cron.daily/ >> /root/.ash_history \
&& echo go-crond -v --run-parts=10s:guest:examples/cron.daily/ >> /root/.ash_history \
&& echo go-crond -v --run-parts=10s:examples/cron.daily/ >> /root/.ash_history \
&& echo go-crond -v >> /root/.ash_history
WORKDIR /go/src/github.com/webdevops/go-crond
# Get deps (cached)
COPY ./go.mod /go/src/github.com/webdevops/go-crond
COPY ./go.sum /go/src/github.com/webdevops/go-crond
RUN go mod download
# Copy source
COPY . /go/src/github.com/webdevops/go-crond
# Build and install
RUN make build \
&& cp -a go-crond /usr/local/bin
ENV SERVER_BIND=":8080" \
SERVER_METRICS="1"
CMD ["./go-crond"]