mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-07-02 01:27:27 -04:00
bump to alpine:3.20 and optimize image using either from:scratch or pyinstaller
This commit is contained in:
@ -1,44 +1,35 @@
|
||||
FROM golang:1.21-alpine AS builder
|
||||
FROM golang:1.23-alpine AS builder
|
||||
#
|
||||
ENV GO111MODULE=on \
|
||||
CGO_ENABLED=0 \
|
||||
GOOS=linux
|
||||
#
|
||||
# Install packages
|
||||
RUN apk --no-cache -U add \
|
||||
build-base \
|
||||
git \
|
||||
go \
|
||||
g++ && \
|
||||
build-base \
|
||||
git \
|
||||
g++
|
||||
#
|
||||
# Setup go, build medpot
|
||||
export GOPATH=/opt/go/ && \
|
||||
export GO111MODULE=off && \
|
||||
mkdir -p /opt/go/src && \
|
||||
cd /opt/go/src && \
|
||||
git clone https://github.com/schmalle/medpot && \
|
||||
cd medpot && \
|
||||
RUN mkdir -p /usr/local/go/src/medpot && \
|
||||
git clone https://github.com/schmalle/medpot /usr/local/go/src/medpot && \
|
||||
cd /usr/local/go/src/medpot && \
|
||||
git checkout 75a2e6134cf926c35b6017d62542274434c87388 && \
|
||||
cd .. && \
|
||||
go get -d -v github.com/davecgh/go-spew/spew && \
|
||||
go get -d -v github.com/go-ini/ini && \
|
||||
go get -d -v github.com/mozillazg/request && \
|
||||
go get -d -v go.uber.org/zap && \
|
||||
cd medpot && \
|
||||
go mod init github.com/schmalle/medpot && \
|
||||
go mod tidy && \
|
||||
go mod download && \
|
||||
cp dist/etc/ews.cfg /etc/ && \
|
||||
go build medpot
|
||||
#
|
||||
FROM alpine:3.19
|
||||
FROM scratch
|
||||
#
|
||||
# Setup medpot
|
||||
#
|
||||
COPY --from=builder /opt/go/src/medpot/medpot /opt/medpot/medpot
|
||||
COPY --from=builder /opt/go/src/medpot/template/*.xml /opt/medpot/
|
||||
COPY --from=builder /opt/go/src/medpot/dist/etc/ews.cfg /etc/ews.cfg
|
||||
RUN mkdir -p /var/log/medpot && \
|
||||
#
|
||||
# Setup user, groups and configs
|
||||
addgroup -g 2000 medpot && \
|
||||
adduser -S -s /bin/ash -u 2000 -D -g 2000 medpot && \
|
||||
chown -R medpot:medpot /var/log/medpot
|
||||
COPY --from=builder /usr/local/go/src/medpot/medpot /opt/medpot/medpot
|
||||
COPY --from=builder /usr/local/go/src/medpot/template/*.xml /opt/medpot/
|
||||
COPY --from=builder /usr/local/go/src/medpot/dist/etc/ews.cfg /etc/ews.cfg
|
||||
#
|
||||
# Start medpot
|
||||
WORKDIR /opt/medpot
|
||||
USER medpot:medpot
|
||||
USER 2000:2000
|
||||
CMD ["./medpot"]
|
||||
|
Reference in New Issue
Block a user