5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-22 09:30:28 +00:00

Merge pull request #221 from jcgruenhage/reduce-container-image-size

Reduce container image size
This commit is contained in:
Arceliar 2018-12-04 18:54:58 -06:00 committed by GitHub
commit cc066d7aeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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