fasten-onprem/Dockerfile

59 lines
2.0 KiB
Docker
Raw Normal View History

#########################################################################################################
# Frontend Build
#########################################################################################################
2023-01-26 04:08:13 -07:00
# !!!! GAH !!!!
# https://blog.thesparktree.com/docker-multi-arch-github-actions#q-i-enabled-multi-arch-builds-and-my-builds-take-1h-what-gives
# https://github.com/fastenhealth/fasten-onprem/issues/43
#make sure you run `make frontend-build-sandbox` or `make frontend-build-main` before `docker build .`
#FROM node:18 as frontend-build
#ARG FASTEN_ENV=sandbox
#WORKDIR /usr/src/fastenhealth/frontend
#COPY frontend/ ./
#
#RUN yarn install --frozen-lockfile && \
# yarn run build -- --configuration ${FASTEN_ENV} --output-path=../dist
#########################################################################################################
# Backend Build
#########################################################################################################
FROM golang:1.18 as backend-build
WORKDIR /go/src/github.com/fastenhealth/fastenhealth-onprem
COPY . .
RUN go mod vendor \
&& go install github.com/golang/mock/mockgen@v1.6.0 \
&& go generate ./... \
&& go vet ./... \
&& go test ./...
RUN CGO_ENABLED=0 go build -o /go/bin/fasten ./backend/cmd/fasten/
2022-09-26 23:14:29 -06:00
# create folder structure
RUN mkdir -p /opt/fasten/db \
2022-09-27 23:23:40 -06:00
&& mkdir -p /opt/fasten/web \
2022-12-17 16:10:19 -07:00
&& mkdir -p /opt/fasten/config
#########################################################################################################
# Distribution Build
#########################################################################################################
2022-12-17 16:10:19 -07:00
FROM gcr.io/distroless/static-debian11
2022-09-26 23:14:29 -06:00
WORKDIR /opt/fasten/
COPY --from=backend-build /opt/fasten/ /opt/fasten/
2023-01-26 04:08:13 -07:00
COPY dist/ /opt/fasten/web/
COPY --from=backend-build /go/bin/fasten /opt/fasten/fasten
COPY LICENSE.md /opt/fasten/LICENSE.md
2022-09-26 23:14:29 -06:00
COPY config.yaml /opt/fasten/config/config.yaml
2022-12-17 16:10:19 -07:00
CMD ["/opt/fasten/fasten", "start", "--config", "/opt/fasten/config/config.yaml"]