37 lines
No EOL
826 B
Docker
37 lines
No EOL
826 B
Docker
# Build frontend
|
|
FROM node:21-alpine3.17 as frontend
|
|
WORKDIR /app
|
|
COPY ./frontend /app
|
|
RUN npm install && npm run build
|
|
|
|
# Build backend
|
|
FROM golang:1.21.3-alpine3.17 as backend
|
|
WORKDIR /app
|
|
RUN apk update --no-cache && apk add --no-cache tzdata
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download && go mod verify
|
|
COPY . .
|
|
COPY --from=frontend /app/dist /app/frontend/dist
|
|
RUN go build -o nquest *.go
|
|
|
|
# Runtime container
|
|
FROM alpine:3.17
|
|
WORKDIR /app
|
|
RUN apk update --no-cache && apk add --no-cache ca-certificates
|
|
|
|
COPY --from=backend /usr/share/zoneinfo/Europe/Moscow /usr/share/zoneinfo/Europe/Moscow
|
|
COPY --from=backend /app/nquest /app/nquest
|
|
|
|
ENV TZ Europe/Moscow
|
|
|
|
ENV PG_HOST nquestdb
|
|
ENV PG_NAME nquest
|
|
ENV PG_USER nquest
|
|
ENV PG_PASS nquest
|
|
ENV PG_PORT 5432
|
|
ENV SECRET s3cr3t
|
|
ENV LISTEN :8000
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["/app/nquest"] |