nquest/Dockerfile

32 lines
884 B
Text
Raw 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 . .
COPY --from=frontend /app/dist /app/frontend/dist
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
ENV TZ Europe/Moscow
EXPOSE 8000
CMD ["/app/nquest"]