Skip to content

Instantly share code, notes, and snippets.

@SumonMSelim
Created March 19, 2025 21:46
Show Gist options
  • Save SumonMSelim/9c6b464b14c03190b97ccb405952faac to your computer and use it in GitHub Desktop.
Save SumonMSelim/9c6b464b14c03190b97ccb405952faac to your computer and use it in GitHub Desktop.
ARG goversion=1
ARG alpineversion=3.20.3
ARG argocdversion=v2.12.6
#########################
# Base builder
#########################
FROM golang:${goversion}-alpine3.20 AS builder-base
WORKDIR /core
RUN apk --no-cache --update add \
make \
build-base \
git
RUN mkdir bin
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod go mod download && go mod verify
COPY . .
#########################
# Admin backend service
#########################
# Stage 1: Build
FROM builder-base AS admin-backend-builder
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build make admin-backend
# Stage 2: Admin Base Image
FROM alpine:${alpineversion} AS admin-backend
# Copy the built admin backend binary and configuration files
COPY --link --from=admin-backend-builder /core/bin/admin /usr/local/bin/
RUN chmod +x /usr/local/bin/admin
ENTRYPOINT ["/usr/local/bin/admin"]
CMD ["run", "--config-path", "/etc/xfab", "--http-port", "8081"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment