2018-11-22 01:03:58 +01:00
|
|
|
# -- stage 1: build static routinator with musl libc for alpine
|
2019-08-21 18:38:01 +02:00
|
|
|
FROM alpine:3.10.2 as build
|
2018-11-22 01:03:58 +01:00
|
|
|
|
2019-08-19 12:43:51 +02:00
|
|
|
RUN apk add rust cargo
|
2018-11-22 01:03:58 +01:00
|
|
|
|
|
|
|
WORKDIR /tmp/routinator
|
|
|
|
COPY . .
|
|
|
|
|
2019-08-17 01:15:53 +02:00
|
|
|
RUN cargo build --target x86_64-alpine-linux-musl --release --locked
|
2018-11-22 01:03:58 +01:00
|
|
|
|
2019-05-29 16:48:49 +02:00
|
|
|
# -- stage 2: create alpine-based container with the static routinator
|
|
|
|
# executable
|
2019-08-21 18:38:01 +02:00
|
|
|
FROM alpine:3.10.2
|
2019-08-17 01:15:53 +02:00
|
|
|
COPY --from=build /tmp/routinator/target/x86_64-alpine-linux-musl/release/routinator /usr/local/bin/
|
2018-11-22 01:03:58 +01:00
|
|
|
|
2019-08-28 11:09:10 +10:00
|
|
|
# Build variables for uid and guid of user to run container
|
|
|
|
ARG RUN_USER=routinator
|
|
|
|
ARG RUN_USER_UID=1012
|
|
|
|
ARG RUN_USER_GID=1012
|
|
|
|
|
2018-11-22 01:03:58 +01:00
|
|
|
# Install rsync as routinator depends on it
|
2019-08-17 01:15:53 +02:00
|
|
|
RUN apk add rsync libgcc
|
2018-11-22 01:03:58 +01:00
|
|
|
|
2019-08-28 11:09:10 +10:00
|
|
|
RUN addgroup -g ${RUN_USER_GID} ${RUN_USER} && \
|
|
|
|
adduser -D -u ${RUN_USER_UID} -G ${RUN_USER} ${RUN_USER}
|
|
|
|
|
2019-05-29 16:48:49 +02:00
|
|
|
# Create the repository and TAL directories
|
2019-08-28 11:09:10 +10:00
|
|
|
RUN mkdir -p /home/${RUN_USER}/.rpki-cache/repository /home/${RUN_USER}/.rpki-cache/tals && \
|
2019-09-02 21:44:24 +02:00
|
|
|
chown -R ${RUN_USER_UID}:${RUN_USER_GID} /usr/local/bin/routinator /home/${RUN_USER}/.rpki-cache
|
2018-11-22 13:26:59 +01:00
|
|
|
|
2019-05-29 16:48:49 +02:00
|
|
|
# Due to ARIN TAL distribution terms, we can't do this here.
|
|
|
|
# An individual user, however, might want to anyway - after reviewing
|
|
|
|
# https://www.arin.net/resources/rpki/tal.html.
|
|
|
|
#
|
|
|
|
#COPY --from=build /tmp/routinator/tals/*.tal /root/.rpki-cache/tals/
|
2018-11-22 20:31:02 +01:00
|
|
|
|
2019-08-28 11:09:10 +10:00
|
|
|
USER $RUN_USER_UID
|
|
|
|
|
2018-11-22 01:03:58 +01:00
|
|
|
EXPOSE 3323/tcp
|
2019-06-03 12:52:34 +02:00
|
|
|
EXPOSE 9556/tcp
|
2019-08-28 11:09:10 +10:00
|
|
|
|
2019-05-29 16:48:49 +02:00
|
|
|
ENTRYPOINT ["routinator"]
|
2019-06-03 12:52:34 +02:00
|
|
|
CMD ["server", "--rtr", "0.0.0.0:3323", "--http", "0.0.0.0:9556"]
|