tzhash/Dockerfile
Evgeniy Kulikov 5cf44c62ac
Initial
2018-12-29 16:04:17 +03:00

36 lines
1.6 KiB
Docker

FROM golang:1.11-alpine3.8 as builder
RUN set -x \
&& apk add --no-cache \
git \
curl \
&& mkdir -p /tmp \
&& mkdir -p /fixtures \
&& curl -s https://loripsum.net/api/1/verylong/plaintext | awk 'NF' - | cat > /fixtures/01.txt \
&& curl -s https://loripsum.net/api/1/verylong/plaintext | awk 'NF' - | cat > /fixtures/02.txt \
&& curl -s https://loripsum.net/api/1/verylong/plaintext | awk 'NF' - | cat > /fixtures/03.txt \
&& curl -s https://loripsum.net/api/1/verylong/plaintext | awk 'NF' - | cat > /fixtures/04.txt \
&& curl -s https://loripsum.net/api/1/verylong/plaintext | awk 'NF' - | cat > /fixtures/05.txt \
&& curl -s https://loripsum.net/api/1/verylong/plaintext | awk 'NF' - | cat > /fixtures/06.txt \
&& curl -s https://loripsum.net/api/1/verylong/plaintext | awk 'NF' - | cat > /fixtures/07.txt \
&& curl -s https://loripsum.net/api/1/verylong/plaintext | awk 'NF' - | cat > /fixtures/08.txt \
&& curl -s https://loripsum.net/api/1/verylong/plaintext | awk 'NF' - | cat > /fixtures/09.txt \
&& curl -s https://loripsum.net/api/1/verylong/plaintext | awk 'NF' - | cat > /fixtures/10.txt
COPY . /tzhash
WORKDIR /tzhash
# https://github.com/golang/go/wiki/Modules#how-do-i-use-vendoring-with-modules-is-vendoring-going-away
# go build -mod=vendor
RUN set -x \
&& export CGO_ENABLED=0 \
&& go build -mod=vendor -o /go/bin/homo ./cmd/homo/main.go
# Executable image
FROM alpine:3.8
WORKDIR /fixtures
COPY --from=builder /fixtures /fixtures
COPY --from=builder /go/bin/homo /usr/local/sbin/homo