agola/Dockerfile

67 lines
1.1 KiB
Docker
Raw Permalink Normal View History

ARG AGOLAWEB_IMAGE="agola-web"
FROM $AGOLAWEB_IMAGE as agola-web
2019-02-21 15:10:30 +00:00
#######
####### Build the backend
#######
# base build image
2021-03-15 08:35:40 +00:00
FROM golang:1.16-buster AS build_base
2019-02-21 15:10:30 +00:00
WORKDIR /agola
# use go modules
ENV GO111MODULE=on
# only copy go.mod and go.sum
2019-02-21 15:10:30 +00:00
COPY go.mod .
COPY go.sum .
RUN go mod download
2019-08-05 07:15:21 +00:00
# builds the agola binaries
2019-02-21 15:10:30 +00:00
FROM build_base AS server_builder
2019-08-05 07:15:21 +00:00
# copy all the sources
2019-02-21 15:10:30 +00:00
COPY . .
# copy the agola-web dist
2019-02-21 15:10:30 +00:00
COPY --from=agola-web /agola-web/dist/ /agola-web/dist/
RUN make WEBBUNDLE=1 WEBDISTPATH=/agola-web/dist
#######
####### Build the final image
#######
2019-08-05 07:15:21 +00:00
FROM debian:buster AS agola
2019-02-21 15:10:30 +00:00
WORKDIR /
2019-02-21 15:10:30 +00:00
# Install git needed by gitserver
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
git \
&& rm -rf /var/lib/apt/lists/*
# copy to agola binaries
2019-06-13 13:30:19 +00:00
COPY --from=server_builder /agola/bin/agola /agola/bin/agola-toolbox-* /bin/
ENTRYPOINT ["/bin/agola"]
#######
####### Build the demo image
#######
FROM agola as agolademo
WORKDIR /
# copy the example config
COPY examples/agolademo/config.yml .
ENTRYPOINT ["/bin/agola"]