apiary/Dockerfile

30 lines
968 B
Docker
Raw Normal View History

2021-04-10 05:58:01 +00:00
FROM node:latest as frontend-builder
RUN mkdir -p /app/frontend
COPY web/frontend/yarn.lock /app/frontend/yarn.lock
COPY web/frontend/package.json /app/frontend/package.json
WORKDIR /app/frontend
RUN yarn install
COPY web/frontend /app/frontend
WORKDIR /app/frontend
RUN GENERATE_SOURCEMAP=false yarn build
FROM golang:latest as builder
WORKDIR /app
COPY go.mod /app/go.mod
COPY go.sum /app/go.sum
RUN go mod download
COPY . /app
RUN rm -rf /app/server/frontend
COPY --from=frontend-builder /app/frontend/dist /app/web/frontend/dist
2021-04-10 06:12:06 +00:00
RUN CGO_ENABLED=0 INSTALL_PREFIX=/app make install
2021-04-10 05:58:01 +00:00
FROM alpine:latest
RUN apk add --no-cache curl
WORKDIR /app
2021-04-10 06:12:06 +00:00
COPY --from=builder /app/etc/apiary/apiary.toml /app/apiary.toml
COPY --from=builder /app/bin/apiary /app/apiary
2021-04-10 05:58:01 +00:00
EXPOSE 8080
EXPOSE 2222
2021-11-05 23:56:15 +00:00
HEALTHCHECK --interval=1m --timeout=10s --start-period=5s --retries=3 CMD curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:8080/api/health || exit 1
CMD ["/app/apiary", "serve"]