-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile
71 lines (57 loc) · 2.21 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
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
# https://github.com/neondatabase/serverless/issues/33
# hadolint global ignore=DL3008
FROM rust:bookworm as rust-builder
ARG DEBIAN_FRONTEND=noninteractive
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# install apt dependencies
RUN \
apt-get update -qq \
&& apt-get install -qq --no-install-recommends -o DPkg::Options::=--force-confold -o DPkg::Options::=--force-confdef \
build-essential \
pkg-config \
git \
libssl-dev \
&& apt-get clean -qq && rm -rf /var/lib/apt/lists/*
# get and build the proxy
RUN git clone --recursive https://github.com/neondatabase/neon.git
WORKDIR /neon
RUN cargo build --bin proxy --features "testing"
FROM debian:bookworm-slim
ARG DEBIAN_FRONTEND=noninteractive
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# install apt dependencies
RUN \
apt-get update -qq \
&& apt-get install -qq --no-install-recommends -o DPkg::Options::=--force-confold -o DPkg::Options::=--force-confdef \
curl \
ca-certificates \
openssl \
postgresql-client \
&& apt-get clean -qq && rm -rf /var/lib/apt/lists/*
# install caddy
RUN \
apt-get update -qq \
&& apt-get install -qq --no-install-recommends -o DPkg::Options::=--force-confold -o DPkg::Options::=--force-confdef \
gnupg2 debian-keyring debian-archive-keyring apt-transport-https \
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg2 --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg \
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list \
&& apt-get update -qq \
&& apt-get install -qq --no-install-recommends -o DPkg::Options::=--force-confold -o DPkg::Options::=--force-confdef \
caddy \
&& apt-get clean -qq && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# create a self-signed cert for *.localtest.me (see https://readme.localtest.me/)
RUN openssl req -new -x509 \
-days 365 \
-nodes -text \
-out server.pem \
-keyout server.key \
-subj "/CN=*.localtest.me" \
-addext "subjectAltName = DNS:*.localtest.me"
# copy the proxy binary
COPY --from=rust-builder /neon/target/debug/proxy ./neon-proxy
COPY $PWD/Caddyfile Caddyfile
COPY $PWD/start.sh start.sh
RUN chmod +x start.sh
EXPOSE 4444
ENTRYPOINT ["./start.sh"]