Skip to content

Commit ee59d91

Browse files
author
lijianguo
committed
fix(build): base image replace by alpine
1 parent 2ac5aba commit ee59d91

2 files changed

Lines changed: 17 additions & 38 deletions

File tree

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ bootstrap:
2525
# This illustrates a two-stage Docker build. docker-compile runs inside of
2626
# the Docker environment. Other alternatives are cross-compiling, doing
2727
# the build as a `docker build`.
28+
build-binary:
29+
CGO_ENABLED=0 go build -ldflags ${LDFLAGS} -o ${BINARY_DEST_DIR}/boot boot.go
30+
2831
build:
29-
${DEV_ENV_CMD} go build -ldflags ${LDFLAGS} -o ${BINARY_DEST_DIR}/boot boot.go
32+
${DEV_ENV_CMD} make build-binary
3033

3134
test: test-style test-unit
3235

rootfs/Dockerfile

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,22 @@
1-
FROM drycc/base:v0.3.6
1+
FROM alpine:3.12
22

3-
RUN adduser --system \
4-
--shell /bin/bash \
5-
--disabled-password \
6-
--home /home/git \
7-
--group \
3+
RUN adduser \
4+
-s /bin/sh \
5+
-D \
6+
-h /home/git \
7+
git \
88
git
99

10-
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E1DF1F24 && \
11-
echo "deb http://ppa.launchpad.net/git-core/ppa/ubuntu xenial main" >> /etc/apt/sources.list && \
12-
apt-get update && \
13-
apt-get install -y --no-install-recommends \
14-
git \
15-
sudo \
16-
openssh-server \
17-
coreutils \
18-
tar \
19-
xz-utils && \
20-
mkdir -p /var/run/sshd && \
21-
rm -rf /etc/ssh/ssh_host* && \
22-
mkdir /apps && \
23-
passwd -u git && \
24-
# cleanup
25-
apt-get autoremove -y && \
26-
apt-get clean -y && \
27-
rm -rf \
28-
/usr/share/doc \
29-
/usr/share/man \
30-
/usr/share/info \
31-
/usr/share/locale \
32-
/var/lib/apt/lists/* \
33-
/var/log/* \
34-
/var/cache/debconf/* \
35-
/etc/systemd \
36-
/lib/lsb \
37-
/lib/udev \
38-
/usr/lib/x86_64-linux-gnu/gconv/IBM* \
39-
/usr/lib/x86_64-linux-gnu/gconv/EBC* && \
40-
bash -c "mkdir -p /usr/share/man/man{1..8}"
10+
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
11+
&& apk add --update git sudo openssh-server coreutils tar xz \
12+
&& mkdir -p /var/run/sshd \
13+
&& rm -rf /etc/ssh/ssh_host* \
14+
&& mkdir /apps \
15+
&& passwd -u git
4116

4217
COPY . /
4318

4419
CMD ["/usr/bin/boot", "server"]
20+
4521
EXPOSE 2223
4622
EXPOSE 3000

0 commit comments

Comments
 (0)