55 lines
816 B
Docker
55 lines
816 B
Docker
ARG REPO_ARCH=amd64
|
|
|
|
# cross-build environment
|
|
FROM asonix/rust-builder:$REPO_ARCH-latest AS builder
|
|
|
|
ARG TAG=main
|
|
ARG BINARY=conduit
|
|
ARG PROJECT=conduit
|
|
ARG GIT_REPOSITORY=https://gitlab.com/famedly/$PROJECT
|
|
|
|
ENV\
|
|
BINARY=${BINARY}
|
|
|
|
USER root
|
|
RUN \
|
|
apt install git
|
|
USER build
|
|
|
|
RUN \
|
|
git clone $GIT_REPOSITORY $PROJECT
|
|
|
|
WORKDIR /opt/build/$PROJECT
|
|
|
|
RUN \
|
|
git checkout $TAG && \
|
|
rm rust-toolchain && \
|
|
build
|
|
|
|
# production environment
|
|
FROM asonix/rust-runner:$REPO_ARCH-latest
|
|
|
|
ENV CONDUIT_CONFIG="/opt/app/conduit.toml"
|
|
|
|
USER root
|
|
|
|
RUN \
|
|
apk add --no-cache \
|
|
ca-certificates \
|
|
curl \
|
|
libgcc
|
|
|
|
COPY --from=builder \
|
|
/opt/build/binary \
|
|
/usr/local/bin/conduit
|
|
|
|
RUN \
|
|
chown -R app:app /mnt
|
|
|
|
COPY root/ /
|
|
|
|
VOLUME /mnt
|
|
USER app
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["/sbin/tini", "--"]
|
|
CMD /usr/local/bin/conduit
|