From 3efc0a4d6c3f0ec11bd0ccf8e214a1427f8e455a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20V=C6=B0=C6=A1ng?= Date: Thu, 16 Nov 2023 16:55:01 +0700 Subject: [PATCH 1/3] Add docker for server Tomcat Folder server --- server/Dockerfile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 server/Dockerfile diff --git a/server/Dockerfile b/server/Dockerfile new file mode 100644 index 00000000..a827a213 --- /dev/null +++ b/server/Dockerfile @@ -0,0 +1,17 @@ +FROM tomcat:8.5-jre8 + +LABEL org.opencontainers.image.source=https://github.com/hardingadonis/miu-shop +LABEL org.opencontainers.image.description="Container that runs Tomcat for Miu Shop" +LABEL org.opencontainers.image.licenses=Apache-2.0 + +LABEL maintainer=hardingadonis@gmail.com +LABEL maintainer=hardingadonis@gmail.com + +# Copy the war file to the container +COPY ./*.war /usr/local/tomcat/webapps/miu.war + +# Set the default port +EXPOSE 8080 + +# Set the default command +CMD ["catalina.sh", "run"] \ No newline at end of file From fd0c45ba7db0f3fe4ac19122112dc61501ed6fd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20V=C6=B0=C6=A1ng?= Date: Thu, 16 Nov 2023 16:56:22 +0700 Subject: [PATCH 2/3] Add docker for database MySQL --- database/Dockerfile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 database/Dockerfile diff --git a/database/Dockerfile b/database/Dockerfile new file mode 100644 index 00000000..ae95721f --- /dev/null +++ b/database/Dockerfile @@ -0,0 +1,19 @@ +FROM mysql:8.1.0 + +LABEL org.opencontainers.image.source=https://github.com/hardingadonis/miu-shop +LABEL org.opencontainers.image.description="Container that runs MySQL for Miu Shop" +LABEL org.opencontainers.image.licenses=Apache-2.0 + +LABEL maintainer=hardingadonis@gmail.com + +# Copy the database schema to the container +COPY ./setup.sql /docker-entrypoint-initdb.d/setup.sql + +# Set the empty password for the root user +ENV MYSQL_ALLOW_EMPTY_PASSWORD yes + +# Set the default database name +ENV MYSQL_DATABASE=miu + +# Set the default port +EXPOSE 3306 \ No newline at end of file From e807ee7dac8c192e0ee9ca46dacf4a4ca23f894e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20V=C6=B0=C6=A1ng?= Date: Thu, 16 Nov 2023 17:03:00 +0700 Subject: [PATCH 3/3] Add docker-compose --- docker-compose.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..566ec238 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3' + +services: + database: + image: ghcr.io/hardingadonis/miu-shop-database:1.0.0 + ports: + - "3306:3306" + + server: + image: ghcr.io/hardingadonis/miu-shop-server:1.0.0 + ports: + - "8080:8080" + depends_on: + - database \ No newline at end of file