reducing docker image size

This commit is contained in:
balzack 2024-03-08 17:54:56 -08:00
parent 8b15004b48
commit fa9c08222d

View File

@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:20.04 as build
ARG TARGETPLATFORM
LABEL maintainer="roland.osborne@gmail.com"
@ -7,22 +7,9 @@ EXPOSE 7000
ENV TZ=America/Los_Angeles
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update
RUN apt-get update
RUN apt-get -y install curl
RUN apt-get -y install net-tools
RUN apt-get -y install jq
RUN apt-get -y install netcat
RUN apt-get -y install unzip
RUN apt-get -y install wget
RUN apt-get -y install git
RUN apt-get -y install vim
RUN apt-get -y install fail2ban
RUN apt-get -y install imagemagick-6.q16
RUN apt-get -y install ffmpeg
RUN apt-get -y install build-essential
RUN apt-get -y install sqlite3
RUN apt-get -y install npm
RUN apt-get -y install curl net-tools jq netcat unzip wget git vim fail2ban imagemagick-6.q16 ffmpeg build-essential sqlite3 npm
RUN apt-get -y upgrade
@ -36,7 +23,7 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then ARCHITECTURE=amd64; elif [ "$
&& wget -P /app https://go.dev/dl/go1.18.10.linux-${ARCHITECTURE}.tar.gz \
&& tar -C /usr/local -xzf /app/go1.18.10.linux-${ARCHITECTURE}.tar.gz
RUN git clone https://github.com/balzack/databag.git /app/databag
RUN git clone https://github.com/balzack/databag.git /app/databag
RUN yarn config set network-timeout 300000
RUN yarn --cwd /app/databag/net/web install
@ -50,10 +37,19 @@ ADD transform /opt/databag/transform
RUN mkdir -p /var/lib/databag
RUN echo 'export PATH=$PATH:/usr/local/go/bin' >> /root/.bashrc
RUN echo "set expandtab\nset tabstop=2\nset softtabstop=2\nset shiftwidth=2\n" > /root/.vimrc
RUN echo "set expandtab\nset tabstop=2\nset softtabstop=2\nset shiftwidth=2\nset encoding=utf-8\nset fileencoding=utf-8\n" > /root/.vimrc
RUN echo "bind 'set mark-symlinked-directories on'" >> /root/.bashrc
ADD entrypoint.sh /app
RUN yarn cache clean
RUN rm -rf /app/databag/net/web/node_modules
RUN rm -rf /var/lib/apt/lists
RUN apt-get -y remove git build-essential npm
FROM scratch
COPY --from=build / /
ENTRYPOINT ["/app/entrypoint.sh"]