Skip to content

Commit

Permalink
Reduce size of Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
gnmyt committed Sep 3, 2024
1 parent 694b3dd commit 7687556
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 28 deletions.
50 changes: 23 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
FROM node:18 AS client-builder
FROM node:18-alpine AS client-builder

WORKDIR /app/client

COPY client/package.json ./
RUN npm install
RUN npm install --only=production && npm cache clean --force

COPY client/ .
RUN npm run build

FROM node:18

RUN apt-get update && \
apt-get install -y \
libcairo2-dev libjpeg62-turbo-dev libpng-dev libossp-uuid-dev \
libavcodec-dev libavutil-dev libswscale-dev \
libpango1.0-dev libpulse-dev libssh2-1-dev libtelnet-dev \
libvncserver-dev libwebp-dev libwebsockets-dev libssl-dev \
libvorbis-dev libwebp-dev \
freerdp2-dev libfreerdp-client2-2 libfreerdp2-2 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

RUN apt-get update && \
apt-get install -y build-essential autoconf libtool && \
git clone https://github.com/apache/guacamole-server.git && \
cd guacamole-server && \
autoreconf -fi && \
./configure --with-init-dir=/etc/init.d --enable-rdp && \
make && \
make install && \
ldconfig && \
cd .. && \
rm -rf guacamole-server
FROM node:18-alpine

RUN apk add --no-cache \
cairo-dev jpeg-dev libpng-dev ossp-uuid-dev ffmpeg-dev \
pango-dev libvncserver-dev libwebp-dev openssl-dev freerdp-dev freerdp \
autoconf automake libtool libpulse libogg libc-dev \
&& apk add --no-cache --virtual .build-deps build-base git

RUN git clone --depth=1 https://github.com/apache/guacamole-server.git \
&& cd guacamole-server \
&& autoreconf -fi \
&& ./configure --with-init-dir=/etc/init.d --enable-rdp \
&& make \
&& make install \
&& cd .. \
&& rm -rf guacamole-server

RUN apk del .build-deps \
&& rm -rf /var/cache/apk/*

ENV NODE_ENV=production

Expand All @@ -39,7 +35,7 @@ WORKDIR /app
COPY --from=client-builder /app/client/dist ./dist

COPY package.json ./
RUN npm install
RUN npm install --omit=dev && npm cache clean --force

COPY server/ server/
COPY docker-start.sh .
Expand All @@ -48,4 +44,4 @@ RUN chmod +x docker-start.sh

EXPOSE 6989

CMD ["./docker-start.sh"]
CMD ["/bin/sh", "docker-start.sh"]
2 changes: 1 addition & 1 deletion docker-start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

guacd -b 0.0.0.0 -l 4822 -f &
guacd -b 0.0.0.0 -l 4822 -f > /dev/null 2>&1 &
exec node server/index.js

0 comments on commit 7687556

Please sign in to comment.