]> git.immae.eu Git - github/bastienwirtz/homer.git/blobdiff - Dockerfile
copy artifacts later in the build step with permissions
[github/bastienwirtz/homer.git] / Dockerfile
index 66788b483963f6d583e53426c1bc24f32152b6f6..29fda0ed766649d85897a9867b77b7f7e8bc01df 100644 (file)
@@ -1,6 +1,16 @@
-FROM alpine:3.11
+# build stage
+FROM node:lts-alpine as build-stage
+
+WORKDIR /app
+
+COPY package*.json ./
+RUN yarn install
 
-COPY ./ /www/
+COPY . .
+RUN yarn build
+
+# production stage
+FROM alpine:3.11
 
 ENV USER darkhttpd
 ENV GROUP darkhttpd
@@ -10,6 +20,8 @@ ENV UID 911
 RUN addgroup -S ${GROUP} -g ${GID} && adduser -D -S -u ${UID} ${USER} ${GROUP} && \
     apk add -U darkhttpd
 
-USER darkhttpd
+USER ${USER}
+
+COPY --from=build-stage --chown=${USER}:${GROUP} /app/dist /www/
 
-ENTRYPOINT ["darkhttpd","/www/"]
+ENTRYPOINT ["darkhttpd","/www/", "--no-listing"]
\ No newline at end of file