-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
63 lines (49 loc) · 1.78 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Copyright 2020 The Ledger Authors
#
# Licensed under the AGPL, Version 3.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.gnu.org/licenses/agpl-3.0.en.html
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM golang:1.14-buster as builder
LABEL author="Daniel Negri <[email protected]>"
ENV GO111MODULE=on
RUN set -x \
&& apt-get update \
&& apt-get install -y build-essential ca-certificates git-core zip \
&& rm -rf /var/lib/apt/lists/*
RUN set -x \
&& go get github.com/AlekSi/gocov-xml \
&& go get github.com/axw/gocov/gocov \
&& go get github.com/t-yuki/gocover-cobertura \
&& go get github.com/tebeka/go2xunit
COPY . /go/src/github.com/danielnegri/tokenapi-go
WORKDIR /go/src/github.com/danielnegri/tokenapi-go
RUN set -x \
&& make testall \
&& make release-binary \
&& mkdir -p /usr/share/tokenapi-go \
&& cp -r ./release/bin /usr/share/tokenapi-go/. \
&& cp -r ./results /usr/share/tokenapi-go/. \
&& echo "Build complete."
# Release
FROM debian:buster
LABEL author="Daniel Negri <[email protected]>"
ENV ENVIRONMENT=prod
ENV GIN_MODE=release
RUN set -x \
&& apt-get update \
&& apt-get install -y ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/share/tokenapi-go /usr/share/tokenapi-go
RUN ln -s /usr/share/tokenapi-go/bin/ledger /usr/bin/ledger
WORKDIR /usr/share/tokenapi-go
EXPOSE 8080
ENTRYPOINT ["ledger"]
CMD ["serve"]