generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile.box
43 lines (33 loc) · 1003 Bytes
/
Dockerfile.box
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
FROM ubuntu:24.04 AS builder
RUN apt-get update
RUN apt-get install -y curl git zip
# Seed some of the most common tools - this will be cached
COPY ./bin /src/bin
ENV PATH="/src/bin:$PATH"
ENV HERMIT_STATE_DIR=/hermit
RUN hermit install openjdk-17.0.8_7
# openjre and jbr conflict, but we want the JRE in the cache
RUN go version
RUN java -version
WORKDIR /src
# Download Go dependencies separately so Docker will cache them
COPY go.mod go.sum /src/
RUN go mod download -x
COPY . /src/
# Build runner
RUN just errtrace
# Reset timestamps so that the build state is reset
RUN git ls-files -z | xargs -0 touch -r go.mod
RUN just build ftl
# Finally create the runtime image.
FROM ubuntu:24.04
WORKDIR /root/
ENV PATH="/root/jre/bin:$PATH"
COPY --from=builder /hermit/pkg/openjdk-17.0.8_7/ ./jre/
COPY --from=builder /src/build/release/ftl .
RUN mkdir deployments
# Where the module artifacts are stored
RUN mkdir modules
EXPOSE 8891
EXPOSE 8892
CMD ["/root/ftl", "box-run", "/root/deployments"]