diff options
Diffstat (limited to 'Dockerfile')
-rw-r--r-- | Dockerfile | 33 |
1 files changed, 33 insertions, 0 deletions
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 |