5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-22 04:50:29 +00:00

Reduce container image size

This commit is contained in:
Jan Christian Grünhage 2018-12-04 13:00:01 +01:00
parent 58b60af208
commit 9f4fc3669b
2 changed files with 17 additions and 13 deletions

View File

@ -1,18 +1,22 @@
FROM golang:stretch
MAINTAINER Christer Waren/CWINFO "christer.waren@cwinfo.org"
RUN apt-get update \
&& apt-get upgrade -y
ADD . /src
FROM docker.io/golang:alpine as builder
COPY . /src
WORKDIR /src
RUN apk add git && ./build
RUN adduser --system --home /etc/yggdrasil-network --uid 1000 yggdrasil-network \
&& rm -rf build_* && ./build \
&& cp yggdrasil /usr/bin \
&& cp contrib/docker/entrypoint.sh /
FROM docker.io/alpine
LABEL maintainer="Christer Waren/CWINFO <christer.waren@cwinfo.org>"
COPY --from=builder /src/yggdrasil /usr/bin/yggdrasil
COPY --from=builder /src/yggdrasilctl /usr/bin/yggdrasilctl
COPY contrib/docker/entrypoint.sh /usr/bin/entrypoint.sh
# RUN addgroup -g 1000 -S yggdrasil-network \
# && adduser -u 1000 -S -g 1000 --home /etc/yggdrasil-network yggdrasil-network
#
# USER yggdrasil-network
# TODO: Make running unprivileged work
VOLUME [ "/etc/yggdrasil-network" ]
ENTRYPOINT [ "/entrypoint.sh" ]
ENTRYPOINT [ "/usr/bin/entrypoint.sh" ]

2
contrib/docker/entrypoint.sh Normal file → Executable file
View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
set -e