reducing docker image size further

This commit is contained in:
balzack 2024-03-10 20:42:13 -07:00
parent fa9c08222d
commit 3d6699381a
3 changed files with 35 additions and 3 deletions

View File

@ -41,12 +41,24 @@ RUN echo "set expandtab\nset tabstop=2\nset softtabstop=2\nset shiftwidth=2\nset
RUN echo "bind 'set mark-symlinked-directories on'" >> /root/.bashrc RUN echo "bind 'set mark-symlinked-directories on'" >> /root/.bashrc
ADD entrypoint.sh /app ADD entrypoint.sh /app
ADD dev_setup.sh /app
RUN rm -rf /usr/local/go
RUN rm -rf /root/go
RUN rm -rf /app/go*
RUN rm -rf /root/.cache/go*
RUN yarn cache clean RUN yarn cache clean
RUN rm -rf /app/databag/app
RUN rm -rf /app/databag/net/web/node_modules 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 RUN n prune
RUN npm uninstall -g n
RUN rm -rf /usr/local/n
RUN rm -rf /usr/local/bin/node
RUN apt-get -y remove git build-essential npm vim nodejs
RUN rm -rf /var/lib/apt/lists
FROM scratch FROM scratch
COPY --from=build / / COPY --from=build / /

20
net/container/dev_setup.sh Executable file
View File

@ -0,0 +1,20 @@
cd /root
wget -P /app https://go.dev/dl/go1.18.10.linux-amd64.tar.gz
tar -C /usr/local -xzf /app/go1.18.10.linux-amd64.tar.gz
apt-get update
apt-get -y install git build-essential npm vim
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt install -y nodejs
npm install --global yarn
npm install -g n
n stable
cd /app/databag
git checkout .
yarn --cwd /app/databag/net/web install
yarn --cwd /app/databag/net/web build
cd /app/databag/net/server; /usr/local/go/bin/go build databag

View File

@ -18,5 +18,5 @@ if [ "$DEV" == "1" ]; then
done done
else else
cd /app/databag/net/server cd /app/databag/net/server
/usr/local/go/bin/go run databag -p 7000 -w /app/databag/net/web/build -s /var/lib/databag -t /opt/databag/transform ./databag -p 7000 -w /app/databag/net/web/build -s /var/lib/databag -t /opt/databag/transform
fi fi