2020-09-17 12:50:37 +02:00
|
|
|
FROM valkum/docker-rust-ci:latest as builder
|
2020-09-17 21:11:18 +02:00
|
|
|
WORKDIR /workdir
|
2020-09-16 19:53:27 +02:00
|
|
|
|
2020-09-17 12:50:37 +02:00
|
|
|
ARG RUSTC_WRAPPER
|
|
|
|
ARG AWS_ACCESS_KEY_ID
|
|
|
|
ARG AWS_SECRET_ACCESS_KEY
|
|
|
|
ARG SCCACHE_BUCKET
|
|
|
|
ARG SCCACHE_ENDPOINT
|
|
|
|
ARG SCCACHE_S3_USE_SSL
|
|
|
|
|
2020-09-16 19:53:27 +02:00
|
|
|
COPY . .
|
|
|
|
RUN cargo build
|
|
|
|
|
2020-09-17 12:50:37 +02:00
|
|
|
FROM valkum/docker-rust-ci:latest
|
2020-09-17 21:11:18 +02:00
|
|
|
WORKDIR /workdir
|
2020-09-17 15:36:36 +02:00
|
|
|
|
2020-10-30 02:57:22 +01:00
|
|
|
RUN curl -OL "https://github.com/caddyserver/caddy/releases/download/v2.2.1/caddy_2.2.1_linux_amd64.tar.gz"
|
|
|
|
RUN tar xzf caddy_2.2.1_linux_amd64.tar.gz
|
2020-09-17 15:36:36 +02:00
|
|
|
|
2020-09-17 21:11:18 +02:00
|
|
|
COPY --from=builder /workdir/target/debug/conduit /workdir/conduit
|
2020-09-17 12:50:37 +02:00
|
|
|
|
2020-09-17 15:36:36 +02:00
|
|
|
COPY Rocket-example.toml Rocket.toml
|
2020-09-17 21:11:18 +02:00
|
|
|
|
|
|
|
ENV SERVER_NAME=localhost
|
2020-10-30 02:57:22 +01:00
|
|
|
ENV ROCKET_LOG=normal
|
2020-09-17 21:11:18 +02:00
|
|
|
|
|
|
|
RUN sed -i "s/port = 14004/port = 8008/g" Rocket.toml
|
2020-10-30 02:57:22 +01:00
|
|
|
RUN echo "federation_enabled = true" >> Rocket.toml
|
2020-09-16 19:53:27 +02:00
|
|
|
|
2020-10-30 02:57:22 +01:00
|
|
|
# Enabled Caddy auto cert generation for complement provided CA.
|
|
|
|
RUN echo '{"apps":{"http":{"https_port":8448,"servers":{"srv0":{"listen":[":8448"],"routes":[{"match":[{"host":["your.server.name"]}],"handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"reverse_proxy","upstreams":[{"dial":"localhost:8008"}]}]}]}],"terminal":true}],"tls_connection_policies": [{"match": {"sni": ["your.server.name"]}}]}}},"pki": {"certificate_authorities": {"local": {"name": "Complement CA","root": {"certificate": "/ca/ca.crt","private_key": "/ca/ca.key"},"intermediate": {"certificate": "/ca/ca.crt","private_key": "/ca/ca.key"}}}},"tls":{"automation":{"policies":[{"subjects":["your.server.name"],"issuer":{"module":"internal"},"on_demand":true},{"issuer":{"module":"internal", "ca": "local"}}]}}}}' > caddy.json
|
|
|
|
|
2020-09-17 15:36:36 +02:00
|
|
|
EXPOSE 8008 8448
|
2020-10-30 02:57:22 +01:00
|
|
|
|
2020-11-09 17:32:04 +01:00
|
|
|
CMD ([ -z "${COMPLEMENT_CA}" ] && echo "Error: Need Complement PKI support" && true) || \
|
2020-11-09 17:21:35 +01:00
|
|
|
sed -i "s/server_name = \"your.server.name\"/server_name = \"${SERVER_NAME}\"/g" Rocket.toml && \
|
2020-10-30 02:57:22 +01:00
|
|
|
sed -i "s/your.server.name/${SERVER_NAME}/g" caddy.json && \
|
|
|
|
/workdir/caddy start --config caddy.json > /dev/null && \
|
2020-11-09 17:21:35 +01:00
|
|
|
/workdir/conduit
|
|
|
|
|