nquest/build/api/Dockerfile

32 lines
No EOL
884 B
Docker

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