cubetiq-react-app/Dockerfile

31 lines
815 B
Docker
Raw Permalink Normal View History

2021-10-21 18:00:40 +07:00
# Build application
FROM cubetiq/calpine-node AS builder
2021-11-10 17:21:26 +07:00
RUN apk update && \
# For build commit hash in "process.env.COMMIT_ID"
apk add git && \
2021-11-10 17:21:26 +07:00
apk add tzdata && \
cp /usr/share/zoneinfo/Asia/Phnom_Penh /etc/localtime && \
echo "Asia/Phnom_Penh" > /etc/timezone
2021-10-21 18:00:40 +07:00
WORKDIR /app
COPY package.json ./
# Set custom registry for npm registry (from cubetiq local server)
RUN yarn config set registry https://r.ctdn.net
RUN yarn
COPY . .
RUN yarn build
# Clean up unused packages
RUN apk del tzdata && \
apk del git
2021-10-21 18:00:40 +07:00
# Build production image
FROM nginx:alpine
LABEL maintainer="sombochea@cubetiqs.com"
WORKDIR /usr/share/nginx/html
COPY --from=builder /app/build/ /usr/share/nginx/html
COPY --from=builder /app/docker/nginx.conf /etc/nginx/conf.d
RUN rm /etc/nginx/conf.d/default.conf
EXPOSE 80