aboutsummaryrefslogtreecommitdiff
path: root/Earthfile
blob: 149622661960d49bf2fa6e52a38c72d87fc4155d (plain)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
VERSION 0.8
FROM debian:bookworm
WORKDIR /app

runtime:
    FROM debian:bookworm

    WORKDIR /app

    RUN apt-get update && apt-get install -y \
        curl \
        wget \
        unzip \
        ca-certificates \
        && rm -rf /var/lib/apt/lists/* \
        && cp /etc/ssl/certs/ca-certificates.crt .

    SAVE ARTIFACT ca-certificates.crt

deps:
    FROM golang:1.24
    WORKDIR /app

    COPY go.mod go.sum ./
    RUN go mod download

    SAVE ARTIFACT go.mod

build:
    FROM +deps
    WORKDIR /app

    ARG PROGRAM=anubis
    ARG GOOS=linux
    ARG GOARCH=amd64
    ARG GOARM

    COPY . .
    ARG VERSION=$(git describe --tags --always --dirty)
    RUN --mount=type=cache,target=/root/.cache go build -o /app/bin/${PROGRAM} -ldflags="-X within.website/x.Version=${VERSION}" ./cmd/${PROGRAM}

    SAVE ARTIFACT bin

ship:
    ARG PROGRAM=anubis
    ARG GOARCH

    FROM --platform=linux/${GOARCH} debian:bookworm
    COPY --platform=${TARGETPLATFORM} (+runtime/ca-certificates.crt) /etc/ssl/certs/ca-certificates.crt
    COPY --platform=${TARGETPLATFORM} (+build/bin/${PROGRAM} --GOARCH=${GOARCH} --PROGRAM=${PROGRAM}) /app/bin/${PROGRAM}

    LABEL org.opencontainers.image.source="https://github.com/Xe/x"

everything:
    FROM +deps

    COPY . .
    ARG VERSION=$(git describe --tags --always --dirty)
    RUN mkdir -p bin
    RUN --mount=type=cache,target=/root/.cache GOBIN=$(pwd)/bin go install -ldflags="-X within.website/x.Version="${VERSION} ./...

    SAVE ARTIFACT bin

aerial:
    BUILD +ship --PROGRAM=aerial --GOARCH=amd64

amano:
    BUILD +ship --PROGRAM=amano --GOARCH=amd64

aura:
    FROM +runtime

    RUN apt-get update && apt-get install -y \
        streamripper vim jq \
        && rm -rf /var/lib/apt/lists/*

    COPY +everything/bin/aura /app/bin/aura
    CMD ["/app/bin/aura"]

    LABEL org.opencontainers.image.source="https://github.com/Xe/x"

    SAVE IMAGE --push ghcr.io/xe/x/aura:latest

future-sight:
    FROM +runtime

    COPY +everything/bin/future-sight /app/bin/future-sight
    CMD ["/app/bin/future-sight"]

    LABEL org.opencontainers.image.source="https://github.com/Xe/x"

    SAVE IMAGE --push ghcr.io/xe/x/future-sight:latest

hdrwtch:
    FROM +runtime

    COPY +everything/bin/hdrwtch /app/bin/hdrwtch
    CMD ["/app/bin/hdrwtch", "--port=8080", "--database-loc=/data/hdrwtch.db"]

    LABEL org.opencontainers.image.source="https://github.com/Xe/x"

    SAVE IMAGE --push ghcr.io/xe/x/hdrwtch:latest

hlang:
    FROM +runtime

    COPY +everything/bin/hlang /app/bin/hlang
    CMD ["/app/bin/hlang", "--port=8080"]

    LABEL org.opencontainers.image.source="https://github.com/Xe/x"

    SAVE IMAGE --push ghcr.io/xe/x/hlang:latest

httpdebug:
    FROM +ship --PROGRAM=httpdebug --GOARCH=amd64
    CMD ["/app/bin/httpdebug"]
    SAVE IMAGE --push ghcr.io/xe/x/httpdebug:latest

mi:
    FROM +runtime

    COPY +everything/bin/mi /app/bin/mi
    CMD ["/app/bin/mi"]

    LABEL org.opencontainers.image.source="https://github.com/Xe/x"

    SAVE IMAGE --push ghcr.io/xe/x/mi:latest

mimi:
    FROM +runtime

    RUN apt-get update && apt-get install -y \
        imagemagick \
        && rm -rf /var/lib/apt/lists/*

    COPY +everything/bin/mimi /app/bin/mimi
    CMD ["/app/bin/mimi"]

    LABEL org.opencontainers.image.source="https://github.com/Xe/x"

    SAVE IMAGE --push ghcr.io/xe/x/mimi:latest

relayd:
    FROM +runtime

    COPY +everything/bin/relayd /app/bin/relayd
    CMD ["/app/bin/relayd"]

    LABEL org.opencontainers.image.source="https://github.com/Xe/x"

    SAVE IMAGE --push ghcr.io/xe/x/relayd:latest

sapientwindex:
    FROM +runtime

    COPY +everything/bin/sapientwindex /app/bin/sapientwindex
    CMD ["/app/bin/sapientwindex"]

    LABEL org.opencontainers.image.source="https://github.com/Xe/x"

    SAVE IMAGE --push ghcr.io/xe/x/sapientwindex:latest

stealthmountain:
    FROM +runtime

    COPY +everything/bin/stealthmountain /app/bin/stealthmountain
    CMD ["/app/bin/stealthmountain"]

    LABEL org.opencontainers.image.source="https://github.com/Xe/x"

    SAVE IMAGE --push ghcr.io/xe/x/stealthmountain:latest

stickers:
    FROM +runtime

    COPY +everything/bin/stickers /app/bin/stickers
    CMD ["/app/bin/stickers"]

    LABEL org.opencontainers.image.source="https://github.com/Xe/x"

    SAVE IMAGE --push ghcr.io/xe/x/stickers:latest

todayinmarch2020:
    FROM +runtime

    COPY +everything/bin/todayinmarch2020 /app/bin/todayinmarch2020
    CMD ["/app/bin/todayinmarch2020", "--port=8080"]

    LABEL org.opencontainers.image.source="https://github.com/Xe/x"

    SAVE IMAGE --push ghcr.io/xe/x/todayinmarch2020:latest

uncle-ted:
    FROM +runtime

    COPY +everything/bin/uncle-ted /app/bin/uncle-ted
    CMD ["/app/bin/uncle-ted"]

    LABEL org.opencontainers.image.source="https://github.com/Xe/x"

    SAVE IMAGE --push ghcr.io/xe/x/uncle-ted:latest

within-website:
    FROM +runtime

    COPY +everything/bin/within.website /app/bin/within.website
    CMD ["/app/bin/within.website", "--port=8080"]

    LABEL org.opencontainers.image.source="https://github.com/Xe/x"

    SAVE IMAGE --push ghcr.io/xe/x/within-website:latest

xedn-static:
    RUN apt-get update && apt-get install -y \
        tar \
        gzip \ 
        wget \
        curl \
        && rm -rf /var/lib/apt/lists/*

    RUN mkdir -p /app/static

    RUN wget https://registry.npmjs.org/@xeserv/xeact/-/xeact-0.69.71.tgz \
     && tar -xzf xeact-0.69.71.tgz \
     && mkdir -p /app/static/pkg/xeact/0.69.71 \
     && cp -r package/* /app/static/pkg/xeact/0.69.71 \
     && rm -rf xeact-0.69.71.tgz package

    RUN wget https://registry.npmjs.org/@xeserv/xeact/-/xeact-0.70.0.tgz \
     && tar -xzf xeact-0.70.0.tgz \
     && mkdir -p /app/static/pkg/xeact/0.70.0 \
     && cp -r package/* /app/static/pkg/xeact/0.70.0 \
     && rm -rf xeact-0.70.0.tgz package

    RUN wget https://registry.npmjs.org/@xeserv/xeact/-/xeact-0.71.0.tgz \
     && tar -xzf xeact-0.71.0.tgz \
     && mkdir -p /app/static/pkg/xeact/0.71.0 \
     && cp -r package/* /app/static/pkg/xeact/0.71.0 \
     && rm -rf xeact-0.71.0.tgz package

    RUN mkdir -p /app/static/css /app/static/pkg/iosevka

    RUN wget https://cdn.xeiaso.net/file/christine-static/dl/iosevka-iaso.tgz \
     && (cd /app/static/pkg/iosevka && tar -xzf /app/iosevka-iaso.tgz) \
     && ln -s /app/static/pkg/iosevka /app/static/css/iosevka \
     && rm -f /iosevka-iaso.tgz

    COPY ./xess/dist/*.css /app/static/pkg/xess/
    COPY ./xess/xess.css /app/static/css/xess.css
    COPY ./xess/xess.css /app/static/pkg/xess/xess.css
    COPY ./xess/static/podkova.css /app/static/pkg/podkova/family.css
    COPY ./xess/static/podkova.woff2 /app/static/pkg/podkova/podkova.woff2
    RUN ln -s /app/static/pkg/podkova /app/static/css/podkova

    SAVE ARTIFACT /app/static

xedn:
    FROM +runtime

    COPY +everything/bin/xedn /app/bin/xedn
    COPY +everything/bin/uplodr /app/bin/uplodr
    COPY +xedn-static/static /app/static
    CMD ["/app/bin/xedn"]
    ENV XEDN_STATIC=/app
    ENV UPLODR_BINARY=/app/bin/uplodr

    LABEL org.opencontainers.image.source="https://github.com/Xe/x"

    SAVE IMAGE --push ghcr.io/xe/x/xedn:latest

all:
    BUILD --pass-args --platform=linux/amd64 +aerial
    BUILD --pass-args --platform=linux/amd64 +amano
    BUILD --pass-args --platform=linux/amd64 +aura
    BUILD --pass-args --platform=linux/amd64 +future-sight
    BUILD --pass-args --platform=linux/amd64 +hdrwtch
    BUILD --pass-args --platform=linux/amd64 +hlang
    BUILD --pass-args --platform=linux/amd64 +httpdebug
    BUILD --pass-args --platform=linux/amd64 +mi
    BUILD --pass-args --platform=linux/amd64 +mimi
    BUILD --pass-args --platform=linux/amd64 +relayd
    BUILD --pass-args --platform=linux/amd64 +sapientwindex
    BUILD --pass-args --platform=linux/amd64 +stealthmountain
    BUILD --pass-args --platform=linux/amd64 +stickers
    BUILD --pass-args --platform=linux/amd64 +todayinmarch2020
    BUILD --pass-args --platform=linux/amd64 +uncle-ted
    BUILD --pass-args --platform=linux/amd64 +within-website
    BUILD --pass-args --platform=linux/amd64 +xedn

    BUILD --pass-args --platform=linux/amd64 ./kube/alrest/staticsites/caddy1+all
    BUILD --pass-args --platform=linux/amd64 ./migroserbices/falin+run