From 34ccc98a942098faefb5f4211b215ff9ccc7ad0e Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Mon, 9 Dec 2024 01:07:15 +0300 Subject: Начальный MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Dockerfile (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1f43c6d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +# 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"] \ No newline at end of file -- cgit v1.2.3