X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=Dockerfile;h=0a43027dc75198b85e2b1302b3637842e88b698a;hb=9e1e82b0f3ce57f95f21fc09c70e2711e5105997;hp=7621639c17956b6c95fdf5147fad9877d484daea;hpb=2b47d9146476b75734a1f1c3da957fa093294dce;p=github%2Fbastienwirtz%2Fhomer.git diff --git a/Dockerfile b/Dockerfile index 7621639..0a43027 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,33 @@ -FROM alpine:3.11 +# build stage +FROM node:lts-alpine as build-stage -COPY ./ /www/ +WORKDIR /app + +COPY package*.json ./ +RUN yarn install --frozen-lockfile + +COPY . . +RUN yarn build + +# production stage +FROM alpine:3.15 ENV USER darkhttpd ENV GROUP darkhttpd ENV GID 911 ENV UID 911 +ENV PORT 8080 RUN addgroup -S ${GROUP} -g ${GID} && adduser -D -S -u ${UID} ${USER} ${GROUP} && \ - apk add -U darkhttpd + apk add -U --no-cache su-exec darkhttpd + +COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist /www/ +COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist/assets /www/default-assets +COPY entrypoint.sh /entrypoint.sh -USER darkhttpd +HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ + CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT}/ || exit 1 -ENTRYPOINT ["darkhttpd","/www/", "--no-listing"] +EXPOSE ${PORT} +VOLUME /www/assets +ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]