Skip to content

Commit 8db4c14

Browse files
committed
chore(Dockerfile): Refactor image to use ubuntu-slim
1 parent f8aba84 commit 8db4c14

2 files changed

Lines changed: 28 additions & 43 deletions

File tree

Makefile

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ glideup:
3535
# the Docker environment. Other alternatives are cross-compiling, doing
3636
# the build as a `docker build`.
3737
build:
38-
${DEV_ENV_PREFIX} -e CGO_ENABLED=0 ${DEV_ENV_IMAGE} go build -a -installsuffix cgo -ldflags ${LDFLAGS} -o ${BINARY_DEST_DIR}/boot boot.go
39-
@$(call check-static-binary,$(BINARY_DEST_DIR)/boot)
40-
${DEV_ENV_PREFIX} ${DEV_ENV_IMAGE} upx -9 ${BINARY_DEST_DIR}/boot
38+
${DEV_ENV_CMD} go build -ldflags ${LDFLAGS} -o ${BINARY_DEST_DIR}/boot boot.go
39+
${DEV_ENV_CMD} upx -9 ${BINARY_DEST_DIR}/boot
4140

4241
test:
4342
${DEV_ENV_CMD} sh -c 'go test $$(glide nv)'
@@ -55,12 +54,3 @@ docker-push:
5554
docker push ${IMAGE}
5655

5756
.PHONY: all build docker-compile kube-up kube-down deploy
58-
59-
define check-static-binary
60-
if file $(1) | egrep -q "(statically linked|Mach-O)"; then \
61-
echo ""; \
62-
else \
63-
echo "The binary file $(1) is not statically linked. Build canceled"; \
64-
exit 1; \
65-
fi
66-
endef

rootfs/Dockerfile

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,32 @@
1-
FROM alpine:3.3
1+
FROM quay.io/deis/base:0.2.0
22

3-
# specify the git user's home and name
4-
ENV GITHOME /home/git
5-
ENV GITUSER git
3+
RUN adduser --system \
4+
--shell /bin/bash \
5+
--disabled-password \
6+
--home /home/git \
7+
--group \
8+
git
9+
10+
COPY . /
611

7-
ENV DEIS_BUILDER_SERVER_SSH_HOST_IP=0.0.0.0
8-
ENV DEIS_BUILDER_SERVER_SSH_HOST_PORT=2223
12+
RUN apt-get update \
13+
&& apt-get install -y \
14+
sudo \
15+
git \
16+
openssh-server \
17+
coreutils \
18+
tar \
19+
xz-utils \
20+
--no-install-recommends \
21+
&& mkdir -p /var/run/sshd \
22+
&& rm -rf /etc/ssh/ssh_host* \
23+
&& mkdir /apps \
24+
&& passwd -u git \
25+
&& apt-get clean \
26+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc
927

28+
CMD ["/usr/bin/boot", "server"]
1029
EXPOSE 2223
1130
EXPOSE 3000
1231

13-
# install common packages, install & configure the SSH server, and set up directories, users & perms.
14-
# NOTE: $GITUSER is added to docker group to use docker without sudo and to slug group in order to share resources with the slug user
15-
RUN apk add --update-cache \
16-
bash \
17-
sudo \
18-
git \
19-
openssh \
20-
coreutils \
21-
tar \
22-
xz \
23-
&& rm -rf /var/cache/apk/* \
24-
&& mkdir -p /var/run/sshd && rm -rf /etc/ssh/ssh_host* \
25-
&& mkdir /apps \
26-
&& adduser -D -h $GITHOME $GITUSER \
27-
&& mkdir -p $GITHOME/.ssh && chown git:git $GITHOME/.ssh \
28-
&& chown -R $GITUSER:$GITUSER $GITHOME \
29-
&& addgroup -g 2000 slug && adduser -D -u 2000 -G slug slug \
30-
&& addgroup $GITUSER slug \
31-
&& passwd -u git
32-
33-
COPY . /
34-
35-
ENV WORKFLOW_RELEASE 2.0.0-dev
36-
37-
ENTRYPOINT ["boot", "server"]
32+
ENV WORKFLOW_RELEASE 2.0.0

0 commit comments

Comments
 (0)