-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
38 lines (31 loc) · 1.01 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Base
FROM imbios/bun-node:22-alpine AS base
WORKDIR /app
COPY package.json ./
COPY bun.lockb ./
COPY tsconfig.json ./
COPY src ./src
COPY .storybook ./.storybook
COPY public ./public
COPY eslint.config.js ./
COPY vite.config.ts ./
RUN bun install --frozen-lockfile && bun run build-storybook
# STAGE 2 => SETUP NGINX and Run
FROM nginxinc/nginx-unprivileged:alpine
USER 0
# Clear default nginx html file
RUN rm -rf /usr/share/nginx/html/*
COPY --from=base /app/storybook-static /usr/share/nginx/html
COPY proxy/nginx.conf /etc/nginx/conf.d/default.conf.template
COPY proxy/securityheaders.conf /etc/nginx/securityheaders.conf
# Copy .env file and shell script to container to handle
# runtime environment variables
WORKDIR /usr/share/nginx/html
COPY ./secrets.sh .
RUN chown -R nginx /etc/nginx/conf.d \
&& chown -R nginx /usr/share/nginx/html \
&& chmod +x ./secrets.sh
# Add bash shell
RUN apk update && apk add --no-cache bash~=5.2.26
USER 101
CMD ["/bin/bash", "-c", "./secrets.sh && nginx -g \"daemon off;\""]