-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
36 lines (26 loc) · 986 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
27
28
29
30
31
32
33
34
35
36
# SPDX-FileCopyrightText: 2021 Kaelan Thijs Fouwels <kaelan.thijs@fouwels.com>
#
# SPDX-License-Identifier: MIT
FROM alpine:3.15.0 as build
# Install tools required for project
RUN apk add go cmake make build-base
ENV VERSION_OPEN62541=1.2.3
WORKDIR /build
RUN wget -q -O open62541.tar.gz https://github.com/open62541/open62541/archive/refs/tags/v$VERSION_OPEN62541.tar.gz && tar -xzf open62541.tar.gz
RUN mkdir -p open62541-${VERSION_OPEN62541}/out
RUN apk add python3
RUN export CC=/usr/bin/clang && export CXX=/usr/bin/clang++
RUN cd open62541-${VERSION_OPEN62541}/out && cmake -DUA_ENABLE_AMALGAMATION=ON -DUA_LOGLEVEL=300 \
..
RUN cd open62541-${VERSION_OPEN62541}/out && make && make install
ENV GOBIN=/go/bin
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . ./go
RUN cd go && go install ./...
FROM alpine:3.15.0
COPY --from=build /go/bin /go/bin
RUN addgroup -S opc && adduser -S opc -G opc
USER opc
CMD ["/go/bin/server"]