-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (20 loc) · 922 Bytes
/
Dockerfile
File metadata and controls
33 lines (20 loc) · 922 Bytes
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
FROM golang:latest AS builder
ARG BRANCH=${BRANCH:-main}
ARG OSVC_GITREPO_URL=${OSVC_GITREPO_URL:-https://github.com/opensvc/oc3.git}
WORKDIR /opt
RUN git clone $OSVC_GITREPO_URL && echo "Cache busted at $(date): git clone $OSVC_GITREPO_URL"
WORKDIR /opt/oc3
RUN git checkout $BRANCH && echo "Cache busted at $(date): git checkout $BRANCH"
RUN git describe --tags --abbrev > util/version/text/VERSION
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o dist/oc3 .
RUN echo "Cache busted at $(date): oc3 version: $(./dist/oc3 version)"
FROM alpine:3.20.1
RUN apk add --no-cache bash git
COPY --from=builder /opt/oc3/dist/oc3 /usr/bin/oc3
ENTRYPOINT ["/usr/bin/oc3"]
CMD ["worker"]
LABEL \
org.opencontainers.image.authors="OpenSVC SAS" \
org.opencontainers.image.created="${BUILDTIME}" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.url="https://github.com/opensvc/oc3"