pse2_ff/project/frontend/Dockerfile

28 lines
703 B
Docker

FROM oven/bun:1 AS base
WORKDIR /usr/src/app
# install dependencies into temp directory
# this will cache them and speed up future builds
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile
COPY . .
# dummy environment variable for build - DONT CHANGE!!!
ENV VITE_API_HOST=SECRET_HOST
RUN bun run build
FROM nginx:1.28.0-alpine3.21
# default environment variable that will be replaced at runtime
ENV API_HOST=http://localhost:5050
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=base /usr/src/app/dist /usr/share/nginx/html
# entrypoint script
COPY docker/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
CMD ["/docker-entrypoint.sh"]