-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContainerfile
29 lines (24 loc) · 927 Bytes
/
Containerfile
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
ARG IMAGE_VERSION=edge
ARG IMAGE_VERSION_GOLANG=1.20-alpine
ARG GOPATH=/usr/local/go
FROM alpine:${IMAGE_VERSION}
LABEL maintainer="Björn Busse <bj.rn@baerlin.eu>"
LABEL org.opencontainers.image.source https://github.com/bbusse/matcha-build
ENV USER="build" \
PACKAGES="git npm xz" \
PATH="/usr/local/go/bin:${PATH}"
COPY --from=golang:1.20-alpine $GOPATH $GOPATH
# Add application user and application
RUN addgroup -S $USER && adduser -S $USER -G $USER \
&& apk add --no-cache ${PACKAGES} \
&& cd /tmp/ && git clone https://github.com/emersion/matcha \
&& cd /tmp/matcha/cmd/matcha && go build \
&& cd /tmp/matcha/public && npm install \
&& cd /tmp/matcha \
&& tar cfJ /tmp/matcha-htdocs.tar.xz public/ \
&& cd cmd/matcha && mv ../../public . \
&& tar cfJ /tmp/matcha.tar.xz matcha public/
USER $USER
# Add entrypoint
COPY matcha-build /usr/local/bin/
ENTRYPOINT ["matcha-build"]