diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..accbfe3e --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,32 @@ +name: Docker ci + +on: + push: + branches: [ master ] + + +jobs: + + docker: + + runs-on: ubuntu-latest + + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Build and push + id: docker_build + uses: docker/build-push-action@v5 + with: + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ secrets.DOCKER_HUB_USERNAME }}/adolla:latest + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..e7b0df62 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +# Stage 1: Build the application +FROM node:16-alpine AS builder + +WORKDIR /app + +COPY package*.json ./ + +RUN npm install + +COPY . . + +RUN npm run build + +# Stage 2: Run the application +FROM node:16-alpine + +WORKDIR /app + +COPY --from=builder /app/ . + +# Create a non-root user and switch to that user +RUN addgroup -g 1001 adollagroup && adduser -u 1001 -G adollagroup -s /bin/sh -D adolla +USER adolla + +# Set environment variables +ENV NODE_ENV production + +EXPOSE 8080 + +CMD ["npm", "start"] diff --git a/compose.yml b/compose.yml new file mode 100644 index 00000000..085b67e0 --- /dev/null +++ b/compose.yml @@ -0,0 +1,20 @@ +version: '3' +services: + adolla: + build: + context: . + dockerfile: Dockerfile + container_name: "adolla" + restart: unless-stopped + environment: + - PORT=8080 # the port the web app will run on + #- MAXREADINGTOSHOWPOPULAR=10 # the amount of items in "continue reading" required to stop showing "popular" on the home page (for faster loading) + #- IGNOREREADING= #stop storing the progress. Old progress will be kept and shown, but nothing new will be added. Useful for shared servers. + #- TELEGRAMTOKEN= # Telegram bot token to send from + #- TELEGRAMUSER= # Telegram user ID to send new chapters & updates to. Not sure what your ID? Plug in your bot token, start the app, and send the bot a message. Adolla will log your user ID. + #- DISCORDWEBHOOK= # Discord webhook URL to send new chapters & updates to. + #- DISABLE_ANALYTICS= # disable sending a message to me when you start Adolla (useful for me to know how many users I have). + #- IMAGE_PROXY_URL= # the URL to use for image proxy. By default is makes a request in the back-end and pipes the response through. It's recommended you use a third-party proxy on lower powered devices like a Raspberry Pi with 1GB of RAM. + #- DIRSUFFIX= # suffix to add to the .adolla folder (for example, DIRSUFFIX=hi makes .adolla-hi) + ports: + - 8080:8080 # host port: docker port. they can be different. \ No newline at end of file