-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
46 lines (40 loc) · 1.16 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
FROM container-registry.oracle.com/graalvm/native-image:17 AS builder
RUN curl -sSL $(curl -s https://api.github.com/repos/upx/upx/releases/latest | \
grep browser_download_url | \
grep amd64 | \
cut -d '"' -f 4) -o upx.tar.xz
RUN microdnf install findutils xz
RUN tar -xf upx.tar.xz && \
cd upx-*-amd64_linux && \
mv upx /bin/upx
COPY . .
RUN chmod +x ./gradlew
RUN ./gradlew server:nativeCompile
RUN /bin/upx --best --lzma ./server/build/native/nativeCompile/server
FROM gcr.io/distroless/base-nossl-debian12 as runner
ARG POSTGRES_PORT
ARG POSTGRES_DB
ARG POSTGRES_USER
ARG POSTGRES_PASSWORD
ARG POSTGRES_HOST
ARG HOST
ARG PORT
ARG REDIRECT_BASE_URL
ARG CORS_PORT
ARG CORS_HOST
ARG CORS_SCHEME
ENV POSTGRES_PORT=${POSTGRES_PORT}
ENV POSTGRES_DB=${POSTGRES_DB}
ENV POSTGRES_USER=${POSTGRES_USER}
ENV POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
ENV POSTGRES_HOST=${POSTGRES_HOST}
ENV HOST=${HOST}
ENV PORT=${PORT}
ENV REDIRECT_BASE_URL=${REDIRECT_BASE_URL}
ENV CORS_PORT=${CORS_PORT}
ENV CORS_HOST=${CORS_HOST}
ENV CORS_SCHEME=${CORS_SCHEME}
EXPOSE ${PORT}
WORKDIR /
COPY --from=builder /app/server/build/native/nativeCompile/server ./server
ENTRYPOINT ["/server"]