-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
26 lines (20 loc) · 749 Bytes
/
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
FROM umputun/baseimage:buildgo-latest as build
ARG GIT_BRANCH
ARG GITHUB_SHA
ARG CI
ENV CGO_ENABLED=0
ADD . /build
WORKDIR /build
RUN \
if [ -z "$CI" ] ; then \
echo "runs outside of CI" && version=$(git rev-parse --abbrev-ref HEAD)-$(git log -1 --format=%h)-$(date +%Y%m%dT%H:%M:%S); \
else version=${GIT_BRANCH}-${GITHUB_SHA:0:7}-$(date +%Y%m%dT%H:%M:%S); fi && \
echo "version=$version" && \
cd app && go build -o /build/rlb -ldflags "-X main.revision=${version} -s -w"
FROM umputun/baseimage:app-latest
# enables automatic changelog generation by tools like Dependabot
LABEL org.opencontainers.image.source="https://github.com/umputun/rlb"
COPY --from=build /build/rlb /srv/rlb
EXPOSE 7070
WORKDIR /srv
CMD ["/srv/rlb"]