From 6af33eaf25dc3097946265b908db19af2e22e40b Mon Sep 17 00:00:00 2001 From: Aitor Date: Wed, 2 Oct 2024 18:48:11 +0200 Subject: [PATCH] Add automatic package generation (Github Actions) --- .dockerignore | 2 ++ .github/workflows/docker-image.yml | 30 ++++++++++++++++++++++++++++++ Dockerfile | 16 ++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/workflows/docker-image.yml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b8cae6c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +Dockerfile +README.md \ No newline at end of file diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..fa2f6ee --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,30 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + # Log in to the Container registry + - name: Log in to the Container registry + run: echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + # Build the Docker image + - name: Build the Docker image + run: docker build . --file Dockerfile --tag aichan-cv:latest + + # Push the Docker image to GHCR + - name: Push Docker images to GHCR + run: | + # Push the main app image + docker push ghcr.io/aitorastorga/aichan-cv:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9dc8ece --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +# Dockerfile +FROM nginx:latest + +ENV DEBIAN_FRONTEND=noninteractive + +# Remove the directory +RUN rm -rf /usr/share/nginx/html + +# Copy the repository to the directory +COPY . /usr/share/nginx/html + +# Expose port 80 for NGINX +EXPOSE 80 + +# Start NGINX +CMD ["nginx", "-g", "daemon off;"]