nquest/build/api/Dockerfile

32 lines
884 B
Text
Raw Permalink Normal View History

# Build frontend
FROM node:21-alpine3.17 as frontend
2024-01-21 17:49:35 +03:00
ARG VERSION
WORKDIR /app
COPY ./frontend /app
RUN echo "@neonxp:registry=https://gitrepo.ru/api/packages/neonxp/npm/" > ~/.npmrc
2024-01-21 17:49:35 +03:00
RUN npm install && VITE_VERSION=${VERSION} npm run build
# Build backend
FROM golang:1.21.3-alpine3.17 as backend
2024-01-21 17:49:35 +03:00
ARG VERSION
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 . .
2024-01-21 17:49:35 +03:00
RUN go build -ldflags="-X gitrepo.ru/neonxp/nquest.Version=${VERSION}" -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
2024-05-05 22:26:52 +03:00
COPY --from=frontend /app/dist /app/frontend/dist
ENV TZ Europe/Moscow
EXPOSE 8000
CMD ["/app/nquest"]