Front

FROM centos:latest
MAINTAINER Peter Park <bgpark82@gmail.com>

# package 다운로드 & git clone
RUN yum install -y epel-release
RUN yum install -y nginx
RUN yum install -y git
RUN git clone https://github.com/pop8682/editx-front.git

# locale 설정
ENV LANG ko_KR.UTF-8
ENV LC_ALL ko_KR.UTF-8
RUN sed -i '/^override_install_langs=/d' /etc/yum.conf
RUN yum reinstall -y glibc-common

# 프로젝트 build
WORKDIR editx-front/
RUN curl --silent --location https://rpm.nodesource.com/setup_10.x | bash -
RUN yum install -y nodejs
RUN npm install
RUN npm run build
# build 파일 /usr/share/nginx/html로 이동
WORKDIR /editx-front/build/
RUN yes | cp -af . /usr/share/nginx/html/

# 프로젝트 delpoy
WORKDIR /etc/nginx
COPY nginx.conf .
CMD ["/usr/sbin/nginx","-g","daemon off;"]

EXPOSE 80

Back

Dockerfile

FROM centos:latest
MAINTAINER Peter Park <bgpark82@gmail.com>

# package 다운로드 & git pull
RUN yum update
RUN yum install -y java-1.8.0-openjdk-devel git
RUN rm -rf editx-test
RUN git clone https://github.com/pop8682/editx-test.git

# JAVA_HOME & locale 설정
ENV JAVA_HOME /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b10-0.el7_6.x86_64/jre/
ENV LANG ko_KR.UTF-8
ENV LC_ALL ko_KR.UTF-8
RUN sed -i '/^override_install_langs=/d' /etc/yum.conf
RUN yum reinstall -y glibc-common

# 프로젝트 build
WORKDIR editx-test
COPY deploy.sh .
RUN ./mvnw clean package

# 프로젝트 deploy
WORKDIR /editx-test/target
CMD ["java","-jar","editx-0.0.1-SNAPSHOT.jar","--spring.profiles.active=product"]

EXPOSE 8080