From e575e0f5cdc01e092ffbe16c1e1c1ffadea40559 Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Sun, 16 Feb 2025 18:34:44 +0100 Subject: [PATCH] Create deployment details --- .gitea/workflows/deploy.yml | 34 ++++++++++++++++++++++++++++++++++ Dockerfile | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 .gitea/workflows/deploy.yml create mode 100644 Dockerfile diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..b739c80 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,34 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + registry: git.gnm.dev + username: ${{ github.actor }} + password: ${{ secrets.GT_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: git.gnm.dev/planspiele/landing-page:latest + + - name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..da2b485 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +# Stage 1: Build the Vite app +FROM node:20 AS build + +# Install pnpm +RUN npm install -g pnpm + +# Set working directory +WORKDIR /app + +# Copy package.json and pnpm-lock.yaml +COPY package.json pnpm-lock.yaml ./ + +# Install dependencies +RUN pnpm install + +# Copy the rest of the application code +COPY . . + +# Build the application +RUN pnpm run build + +# Stage 2: Serve the app with Nginx +FROM nginx:alpine + +# Copy the build output to Nginx's html directory +COPY --from=build /app/dist /usr/share/nginx/html + +# Expose port 80 +EXPOSE 80 + +# Start Nginx server +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file