1
0
Fork 0

added multi-stage builds to dockerfile

This commit is contained in:
martyna 2025-01-03 19:53:23 +01:00 committed by Michał Rudowicz
parent d03bfb9896
commit 0e59be7421
1 changed files with 6 additions and 2 deletions

View File

@ -2,6 +2,10 @@ FROM debian:12-slim
RUN apt update && apt install golang -y --no-install-recommends && apt install ca-certificates -y RUN apt update && apt install golang -y --no-install-recommends && apt install ca-certificates -y
RUN mkdir /src && mkdir /conf RUN mkdir /src && mkdir /conf
COPY . /src COPY . /src
RUN cd /src && go build && mv alarm_bot .. && cd .. && rm -r src && apt remove golang -y && apt autoremove -y RUN cd /src && go build
FROM debian:12-slim
COPY --from=0 /conf /conf
COPY --from=0 /src/alarm_bot /
WORKDIR /conf WORKDIR /conf
CMD /alarm_bot CMD ["/alarm_bot"]