This repository has been archived by the owner on Feb 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEarthfile
102 lines (74 loc) · 2.46 KB
/
Earthfile
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
FROM busybox:1.32
all:
BUILD +test-all
BUILD +publish
sbt:
FROM openjdk:11-jdk-stretch
USER root
# create directories
RUN mkdir /sbt && chmod 777 /sbt
RUN mkdir /logs && chmod 777 /logs
# Install sbt
ARG SBT_VERSION=1.6.2
ARG SBT_URL="https://github.com/sbt/sbt/releases/download/v$SBT_VERSION/sbt-$SBT_VERSION.tgz"
# Install sbt, add symlink
RUN \
curl -fsL "$SBT_URL" | tar xfz - -C /usr/share && \
chown -R root:root /usr/share/sbt && \
chmod -R 755 /usr/share/sbt && \
chmod +x /usr/share/sbt && \
ln -s /usr/share/sbt/bin/sbt /usr/local/bin/sbt
# Switch working directory
WORKDIR /sbt
# This triggers a bunch of useful downloads.
RUN sbt sbtVersion
# install docker tools
# https://docs.docker.com/engine/install/debian/
RUN apt-get remove -y docker docker-engine docker.io containerd runc || true
RUN apt-get update
RUN apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
RUN echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
RUN apt-get update
RUN apt-get install -y docker-ce docker-ce-cli containerd.io
dependencies:
# copy relevant files in, save as a base image
FROM +sbt
# create user & working dir for sbt
ARG BUILD_DIR="/build"
USER root
RUN mkdir $BUILD_DIR && \
chmod 777 /$BUILD_DIR
WORKDIR $BUILD_DIR
# copy configurations
COPY .scalafmt.conf build.sbt .
COPY --dir project .
# clean & install dependencies
RUN sbt clean cleanFiles update
code:
FROM +dependencies
# copy proto definitions & generate
COPY --dir proto .
# copy code
COPY --dir code .
test-all:
FROM +code
USER root
RUN sbt coverage test coverageReport
publish:
FROM +code
ARG VERSION=dev
ARG GITHUB_REF=""
RUN --push \
--secret PGP_PASSPHRASE=+secrets/PGP_PASSPHRASE \
--secret PGP_SECRET=+secrets/PGP_SECRET \
--secret SONATYPE_PASSWORD=+secrets/SONATYPE_PASSWORD \
--secret SONATYPE_USERNAME=+secrets/SONATYPE_USERNAME \
sbt ci-release