summaryrefslogblamecommitdiff
path: root/Dockerfile
blob: 1f43c6d09370a5b6ab731d3fcd43c3650660c5c0 (plain) (tree)
































                                                                                       
# Build backend
FROM golang:1.23.3-alpine3.20 AS backend
WORKDIR /srv
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 -o app .

# Build frontend
FROM node:23.3-alpine3.20 AS frontend
WORKDIR /srv
COPY package.json package-lock.json ./
RUN npm install
COPY frontend ./frontend
COPY --from=backend /srv/app /usr/bin/app
RUN app frontend build

# Runtime container
FROM alpine:3.20
WORKDIR /srv
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 /srv/app /srv/app
COPY ./static/index.html /srv/static/index.html
COPY --from=frontend /srv/static/assets /srv/static/assets

ENV TZ=Europe/Moscow

EXPOSE 8000

ENTRYPOINT ["/srv/app"]