add dockerfile

This commit is contained in:
pluja 2024-02-18 17:17:22 +01:00
parent f672feaea1
commit b8ecef5a6e
2 changed files with 32 additions and 0 deletions

1
src/.dockerignore Normal file
View File

@ -0,0 +1 @@
.env

31
src/Dockerfile Normal file
View File

@ -0,0 +1,31 @@
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"]