kycnot.me/src/Dockerfile

31 lines
841 B
Docker
Raw Normal View History

2024-02-18 11:17:22 -05:00
FROM devopsworks/golang-upx:latest as builder
WORKDIR /app
COPY . .
RUN go mod tidy
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o kycnotme . && \
upx kycnotme
RUN chmod +x kycnotme
# Tailwind CSS compiler
FROM node:latest as tailwind
WORKDIR /app
COPY ./package.json .
COPY ./package-lock.json .
COPY ./tailwind.config.js .
COPY ./frontend/ /app/
RUN npm i && \
npx tailwindcss -i ./static/css/input.css -o ./style.css --minify
FROM alpine:latest as certs
RUN apk --update add ca-certificates
FROM scratch
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
WORKDIR /app
COPY ./frontend/ /app/frontend/
COPY --from=tailwind /app/style.css /app/frontend/static/style.css
COPY --from=builder /app/kycnotme /bin/usr/kycnotme
ENV PATH="/bin/usr:${PATH}"
EXPOSE 4488
ENTRYPOINT ["kycnotme", "-scrap"]