-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
63 lines (45 loc) · 1.71 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
ARG TZ=America/Chicago
FROM golang:1.9-alpine as build-backend
ARG TZ
RUN go version
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
RUN \
apk add --no-cache --update tzdata git &&\
cp /usr/share/zoneinfo/$TZ /etc/localtime &&\
go get -u gopkg.in/alecthomas/gometalinter.v1 && \
ln -s /go/bin/gometalinter.v1 /go/bin/gometalinter && \
gometalinter --install --force
WORKDIR /go/src/github.com/andrievsky/strawberry
ADD app /go/src/github.com/andrievsky/strawberry/app
ADD vendor /go/src/github.com/andrievsky/strawberry/vendor
ADD .git /go/src/github.com/andrievsky/strawberry/.git
RUN cd app && go test ./...
RUN gometalinter --disable-all --deadline=300s --vendor --enable=vet --enable=vetshadow --enable=golint \
--enable=staticcheck --enable=ineffassign --enable=goconst --enable=errcheck --enable=unconvert \
--enable=deadcode --enable=gosimple --exclude=test --exclude=mock --exclude=vendor ./...
RUN \
version=$(git rev-parse --abbrev-ref HEAD)-$(git describe --abbrev=7 --always --tags)-$(date +%Y%m%d-%H:%M:%S) && \
echo "version $version" && \
go build -o strawberry -ldflags "-X main.revision=${version} -s -w" ./app
# FROM node:9.4-alpine as build-frontend
#
# ADD webapp /srv/webapp
# RUN apk add --no-cache --update git python make g++
# RUN \
# cd /srv/webapp && \
# npm i --production && npm run build
FROM alpine:3.7
ARG TZ
COPY --from=build-backend /go/src/github.com/andrievsky/strawberry/strawberry /srv/
RUN \
apk add --update --no-cache tzdata && \
cp /usr/share/zoneinfo/$TZ /etc/localtime &&\
adduser -s /bin/bash -D -u 1001 app && \
chown -R app:app /srv
EXPOSE 8080
USER app
WORKDIR /srv
VOLUME ["/srv/docroot"]
ENTRYPOINT ["/srv/strawberry"]