-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
35 lines (34 loc) · 1.4 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
# build stage
FROM golang:alpine AS builder
LABEL autodelete="true"
ARG REPO=idenadev
ARG IDENA_REPO=idena-network/idena-go
ARG BUILD_TARGET=idena
ARG BUILD_COMMIT=b251f609d9e7375a0b7e00f63ea2fa1754ce7240
ARG BUILD_VERSION=0.22.1
RUN apk add git gcc libc-dev
RUN git clone https://github.com/${IDENA_REPO} /idena
WORKDIR /idena
RUN git reset --hard ${BUILD_COMMIT}
RUN go build -ldflags "-X main.version=${BUILD_VERSION}" -o ${BUILD_TARGET}
RUN strip ${BUILD_TARGET}
# final stage
FROM alpine:latest
ARG BUILD_TARGET=idena
ARG USER=idena
ENV BUILD_TARGET=${BUILD_TARGET}
RUN apk add --update nodejs npm
RUN npm install -i pm2
COPY ./proxy /proxy
RUN cd /proxy && npm install
RUN apk --no-cache add ca-certificates 'su-exec>=0.2' \
&& addgroup $USER -g 500 \
&& adduser -u 500 -D -h /home/$USER -S -s /sbin/nologin -G $USER $USER
COPY --from=builder ${BUILD_TARGET} /usr/local/bin
COPY docker-entrypoint.sh /usr/local/bin/
COPY config.json /home/$USER/
RUN chmod +x /usr/local/bin/${BUILD_TARGET}
WORKDIR /home/$USER
EXPOSE 80
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["", "run"]