diff options
author | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-12-09 01:07:15 +0300 |
---|---|---|
committer | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-12-09 01:07:15 +0300 |
commit | 34ccc98a942098faefb5f4211b215ff9ccc7ad0e (patch) | |
tree | 7696ab4d7c8d9fb09c7e2575d482517f68824ae3 /Dockerfile |
Начальный
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 |