40 lines
1.1 KiB
Docker
40 lines
1.1 KiB
Docker
ARG GO_VERSION=1.23.2
|
|
|
|
################################################################################
|
|
# Stage: builder ###############################################################
|
|
################################################################################
|
|
FROM golang:${GO_VERSION}-alpine AS builder
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
RUN apk add npm
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download && go mod verify
|
|
|
|
COPY . .
|
|
|
|
RUN npm i -g tailwindcss
|
|
RUN npm i -D @tailwindcss/forms
|
|
RUN tailwindcss -i ./public/assets/css/index.css -o ./public/assets/css/output.css
|
|
RUN rm ./public/assets/css/index.css
|
|
|
|
RUN go build -v -o /ptpp-build ./cmd
|
|
|
|
################################################################################
|
|
# Stage: runner ################################################################
|
|
################################################################################
|
|
FROM alpine:latest AS runner
|
|
|
|
WORKDIR /app
|
|
|
|
ENV PATH="/root/go/bin:/app:${PATH}"
|
|
|
|
RUN apk add go
|
|
|
|
COPY --from=builder /ptpp-build .
|
|
COPY --from=builder /usr/src/app/public ./public
|
|
COPY --from=builder /usr/src/app/migrations ./migrations
|
|
|
|
CMD ["ptpp-build"]
|