diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..749db20 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ + +FROM golang:alpine AS builder +ARG TARGETPLATFORM=no-set +ARG version=not-set +ARG SHORTSHA=not-set +WORKDIR /app +COPY . . +# https://stackoverflow.com/questions/70369368/check-architecture-in-dockerfile-to-get-amd-arm +RUN go build -o bin/ddns \ + -ldflags "-X main.Shortsha=${SHORTSHA} \ + -X main.Version=${version} \ + -X main.Aarch=${TARGETPLATFORM}" ./cmd + +FROM alpine AS runner +COPY --from=builder /app/bin/ddns /usr/bin/ +ENTRYPOINT /usr/bin/ddns diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..115ed0f --- /dev/null +++ b/compose.yaml @@ -0,0 +1,4 @@ +services: + ddns: + image: ddns + env_file: ".env"