Skip to content

Commit

Permalink
Merge pull request #14 from datarhei/dockerfile
Browse files Browse the repository at this point in the history
Reduce size, serve production build
  • Loading branch information
ioppermann committed Aug 18, 2022
2 parents 7ffe697 + 3dae99a commit c9b8b6a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Caddyfile
@@ -0,0 +1,6 @@
http://127.0.0.1:3000

encode zstd gzip
file_server {
root ./build
}
12 changes: 10 additions & 2 deletions Dockerfile
@@ -1,6 +1,7 @@
ARG NODE_IMAGE=node:18.6.0-alpine3.15
ARG CADDY_IMAGE=caddy:2.5.2-alpine

FROM $NODE_IMAGE
FROM $NODE_IMAGE as builder

ARG NODE_SPACE_SIZE=10240
ENV NODE_OPTIONS="--openssl-legacy-provider --max-old-space-size=$NODE_SPACE_SIZE"
Expand All @@ -20,6 +21,13 @@ RUN cd /ui && \
npm install && \
npm run build

FROM $CADDY_IMAGE

COPY --from=builder /ui/build /ui/build
COPY --from=builder /ui/Caddyfile /ui/Caddyfile

WORKDIR /ui

EXPOSE 3000

CMD [ "npm", "run", "start" ]
CMD [ "caddy", "run", "-config", "/ui/Caddyfile" ]

0 comments on commit c9b8b6a

Please sign in to comment.