Skip to content

Commit dfffe8f

Browse files
committed
use docker alpine image to optimize image size
1 parent 1e74720 commit dfffe8f

File tree

1 file changed

+7
-40
lines changed

1 file changed

+7
-40
lines changed

Dockerfile

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
1-
FROM golang:1.16.0
1+
FROM golang:1.16.0-alpine
22

33
WORKDIR /go/src/github.com/neel1996/gitconvex-server
44

55
COPY . .
66

7-
# Install required packages from apt-get
8-
RUN apt-get update && \
9-
apt-get install apt-transport-https ca-certificates gnupg software-properties-common wget sudo -y && \
10-
apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' && \
11-
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \
12-
apt-get install cmake -y
13-
14-
# Install node js
15-
RUN curl -fsSL https://deb.nodesource.com/setup_15.x | sudo -E bash - && \
16-
apt-get install nodejs -y
7+
# Install required packages
8+
RUN apk update && \
9+
apk add --update libgit2-dev libssh2-dev gcc make nodejs npm musl-dev
1710

1811
# Building React UI bundle
1912
RUN cd ui/ && \
2013
npm install && \
2114
export NODE_ENV=production && \
15+
npm i -g npm@6 && \
2216
npm install tailwindcss postcss autoprefixer && \
2317
npx tailwindcss build -o src/index.css -c src/tailwind.config.js && \
2418
npm run build && \
@@ -27,35 +21,8 @@ RUN cd ui/ && \
2721
cd .. && \
2822
rm -rf ui/
2923

30-
# Download and build OpenSSL
31-
RUN cd ~ && git clone https://github.com/openssl/openssl.git && \
32-
cd openssl && ./Configure && \
33-
make && make install && \
34-
cp -rp *.so* /usr/lib/
35-
36-
# Download libssh2
37-
RUN cd ~ && wget https://github.com/libssh2/libssh2/releases/download/libssh2-1.9.0/libssh2-1.9.0.tar.gz && \
38-
tar -xzf libssh2-1.9.0.tar.gz && \
39-
cd libssh2-1.9.0/ && \
40-
mkdir build && cd build && \
41-
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_INSTALL_PREFIX=../install .. && cmake --build . --target install
42-
43-
# Download and Libgit2 setup
44-
RUN cd ~ && wget https://github.com/libgit2/libgit2/releases/download/v1.1.0/libgit2-1.1.0.tar.gz && \
45-
tar -xzf libgit2-1.1.0.tar.gz && \
46-
cd libgit2-1.1.0/ && \
47-
mkdir build && cd build && \
48-
cmake -DCMAKE_PREFIX_PATH=../../libssh2-1.9.0/install/ -DCMAKE_INSTALL_PREFIX=../install -DBUILD_CLAR=OFF .. && \
49-
cmake --build . --target install && \
50-
make install && \
51-
cp -rp ~/libgit2-1.1.0/install/include/* /usr/include/ && \
52-
cp -rp ~/libgit2-1.1.0/install/lib/pkgconfig/* /usr/lib/pkgconfig && \
53-
cp -rp ~/libgit2-1.1.0/install/lib/lib* /usr/lib/
54-
55-
# Post Cleanup stage
56-
RUN apt-get remove cmake nodejs apt-transport-https ca-certificates gnupg software-properties-common wget -y
24+
RUN go get -v
5725

5826
EXPOSE 9001
5927

60-
CMD export PKG_CONFIG_PATH=/usr/local/lib && \
61-
go run /go/src/github.com/neel1996/gitconvex-server/server.go
28+
CMD go run /go/src/github.com/neel1996/gitconvex-server/server.go

0 commit comments

Comments
 (0)