Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #48 from hardingadonis/vuong-docker
Browse files Browse the repository at this point in the history
Implement Docker for repository
  • Loading branch information
hardingadonis authored Jan 20, 2024
2 parents 930fe9a + a29d6b8 commit efba06c
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: 'Publish Sale Dock Images'

on:
workflow_run:
workflows: [Release Sale Dock]
types:
- completed
branches:
- main

jobs:
publish:
name: 'Publish Sale Dock Images'
runs-on: ubuntu-latest

if: ${{ github.event.workflow_run.conclusion == 'success' }}

permissions:
contents: read
packages: write

steps:
- name: 'Checkout repository'
uses: actions/checkout@v4

- name: 'Set up JDK 17'
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
architecture: 'x64'

- name: 'Build project with Maven'
run: |
mvn verify
- name: 'Get version'
id: get_version
run: |
chmod +x get_version.sh
echo "version=$(./get_version.sh)" >> $GITHUB_OUTPUT
- name: 'Login ghcr.io'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: 'Publish Sale Dock Database'
working-directory: ${{ github.workspace }}/database
run: |
docker build . -t ghcr.io/hardingadonis/saledock-database:${{ steps.get_version.outputs.version }} -t ghcr.io/hardingadonis/saledock-database:latest
docker push ghcr.io/hardingadonis/saledock-database:${{ steps.get_version.outputs.version }}
docker push ghcr.io/hardingadonis/saledock-database:latest
- name: 'Publish Sale Dock Server'
working-directory: ${{ github.workspace }}/server
run: |
docker build . -t ghcr.io/hardingadonis/saledock-server:${{ steps.get_version.outputs.version }} -t ghcr.io/hardingadonis/saledock-server:latest
docker push ghcr.io/hardingadonis/saledock-server:${{ steps.get_version.outputs.version }}
docker push ghcr.io/hardingadonis/saledock-server:latest
24 changes: 24 additions & 0 deletions database/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM mysql:8.2.0

LABEL org.opencontainers.image.source=https://github.com/hardingadonis/saledock
LABEL org.opencontainers.image.description="Container that runs MySQL for Sale Dock"
LABEL org.opencontainers.image.licenses=Apache-2.0

LABEL [email protected]

# 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=saledock

# Set the default charset and collation
ENV LANG=C.UTF-8
ENV MYSQL_CHARSET=utf8mb4
ENV MYSQL_COLLATION=utf8mb4_general_ci

# Set the default port
EXPOSE 3306
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3'

name: 'saledock'

services:
database:
image: ghcr.io/hardingadonis/saledock-database:latest
ports:
- "3306:3306"

server:
image: ghcr.io/hardingadonis/saledock-server:latest
ports:
- "8080:8080"
depends_on:
- database
16 changes: 16 additions & 0 deletions server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM tomcat:10.1.18-jre17

LABEL org.opencontainers.image.source=https://github.com/hardingadonis/saledock
LABEL org.opencontainers.image.description="Container that runs Tomcat for Sale Dock"
LABEL org.opencontainers.image.licenses=Apache-2.0

LABEL [email protected]

# Copy the war file to the container
COPY ./*.war /usr/local/tomcat/webapps/saledock.war

# Set the default port
EXPOSE 8080

# Set the default command
CMD ["catalina.sh", "run"]

0 comments on commit efba06c

Please sign in to comment.