Docker build

This commit is contained in:
realaravinth 2021-05-12 18:23:25 +05:30
parent 4df220edad
commit d0c5ffb486
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88

View file

@ -6,26 +6,17 @@ WORKDIR /src
COPY package.json yarn.lock ./ COPY package.json yarn.lock ./
RUN yarn install RUN yarn install
COPY . . COPY . .
# RUN set -ex; \
# apt-get update; \
# DEBIAN_FRONTEND=noninteractive \
# apt-get install -y --no-install-recommends yarnpkg npm ca-certificates make libssl-dev; \
# rm -rf /var/lib/apt/lists/*
# RUN pwd
RUN yarn build RUN yarn build
FROM rust:latest as rust FROM rust:latest as rust
COPY --from=frontend /src /src COPY --from=frontend /src /src
WORKDIR /src WORKDIR /src
RUN pwd
RUN ls
RUN cargo build --release RUN cargo build --release
FROM debian:buster FROM debian:buster
RUN useradd -ms /bin/bash -u 1001 guard RUN useradd -ms /bin/bash -u 1001 guard
WORKDIR /home/guard WORKDIR /home/guard
COPY --from=rust /src/target/release/guard /home/guard/app/ COPY --from=rust /src/target/release/guard /usr/local/bin/
COPY --from=rust /src/config /home/guard/app/ COPY --from=rust /src/config/default.toml /etc/guard/config.toml
USER guard USER guard
WORKDIR /home/guard/app CMD [ "/usr/local/bin/guard" ]
CMD [ "/home/guard/app/guard" ]