-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathDockerfile
60 lines (41 loc) · 1.58 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# build the web UI
FROM node:16-alpine as frontend
ARG CI
ADD . /build
WORKDIR /build/frontend
RUN \
if [ -z "$CI" ] ; then \
echo "build frontend outside of CI" && yarn && yarn build; \
else echo "build frontend in CI" && ls -la build; fi
# build the backend registry-admin
FROM golang:1.19-alpine as backend
ARG GIT_BRANCH
ARG GITHUB_SHA
ARG CI
ENV GOFLAGS="-mod=vendor"
ENV CGO_ENABLED=1
ADD . /build
COPY --from=frontend /build/frontend/build /build/app/web
RUN apk add --no-cache --update git tzdata ca-certificates build-base git
WORKDIR /build
RUN \
if [ -z "$CI" ] ; then \
echo "runs outside of CI" && version=$(git rev-parse --abbrev-ref HEAD)-$(git log -1 --format=%h)-$(date +%Y%m%dT%H:%M:%S); \
else version=${GIT_BRANCH}-${GITHUB_SHA:0:7}-$(date +%Y%m%dT%H:%M:%S); fi && \
echo "version=$version" && \
cd app && go build -o /build/registry-admin -ldflags "-X main.version=${version} -s -w"
FROM umputun/baseimage:app-v1.9.2
ENV TIME_ZONE=UTC
LABEL org.opencontainers.image.authors="zebox <[email protected]>" \
org.opencontainers.image.description="Registry administartion UI tool" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.source="https://github.com/zebox/registry-admin.git" \
org.opencontainers.image.title="Registry Admin" \
org.opencontainers.image.url="https://github.com/zebox/registry-admin"
COPY --from=backend /build/registry-admin /app/registry-admin
WORKDIR /app
RUN chown -R app:app /app
RUN ln -s /app/registry-admin /usr/bin/registry-admin
EXPOSE 80
EXPOSE 443
CMD ["/app/registry-admin"]