
✔ 현재 docker image
frontend docker image에 접근, container에서 dockerFile 실행이 잘되었는지 확인하고 싶다.
현재 frontend repository에 있는 dockerFile
FROM node:16.19.0 as build-stage
VOLUME /tmp
WORKDIR /real
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
FROM nginx:stable-alpine as production-stage
RUN rm /etc/nginx/conf.d/default.conf
COPY ./nginx/chuno.conf /etc/nginx/conf.d/default.conf
COPY --from=build-stage /real/dist /usr/share/nginx/html
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]

chuno.conf 파일

✔ ec2에서 docker image, frontend 접속
docker exec -it containerId 경로 (/bin/sh)

COPY ./nginx/chuno.conf /etc/nginx/conf.d/default.conf
접속하니 chuno.conf 파일에 적었던 것을 볼 수 있다.

COPY --from=build-stage /real/dist /usr/share/nginx/html
usr/share/nginx/html에서 ls 하니, gitlab /real/dist에 있던 파일이 넘어갔다.