Capstone/docker/ui.dockerfile

44 lines
854 B
Plaintext
Raw Permalink Normal View History

2023-11-19 10:37:45 -05:00
#Build Go stuff
FROM golang:1.21-alpine AS builder
RUN go install github.com/a-h/templ/cmd/templ@latest
WORKDIR /build/ui
#Setup libs
COPY ui/go.mod ui/go.sum ./
COPY ./service ../service
COPY ./libs ../libs
RUN go mod download
COPY ui/ .
RUN rm **/*_templ.go; templ generate -path ./templates
2023-11-19 10:51:38 -05:00
RUN GOEXPERIMENT=loopvar go build -o main
2023-11-19 10:37:45 -05:00
#Build NPM stuff
FROM node:18-alpine AS node-builder
WORKDIR /build
COPY ui/ .
RUN npm install
2023-11-24 10:58:37 -05:00
RUN npx tailwindcss -i tailwind/index.css -o dist/output.css
2023-11-19 10:37:45 -05:00
#Final Contianer
2023-11-19 21:51:05 -05:00
FROM amazonlinux:2023
2023-11-19 10:37:45 -05:00
2023-11-19 21:51:05 -05:00
COPY docker/resolv.conf /etc/resolv.conf
2023-11-23 13:40:50 -05:00
RUN mkdir -p /var/capstone
2023-11-24 10:58:37 -05:00
COPY ui/static/ /var/capstone/dist
2023-11-23 13:40:50 -05:00
COPY --from=node-builder /build/dist /var/capstone/dist
2023-11-19 10:37:45 -05:00
COPY --from=builder /build/ui/main /bin/main
RUN mkdir -p /etc/capstone
COPY secrets/config.yaml /etc/capstone
EXPOSE "8080"
ENTRYPOINT ["/bin/main"]