diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..23bb7cf --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,30 @@ +name: Deploy to Docker Container + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install dependencies and build + run: | + npm ci + npm run production + + - name: Build Docker image + run: docker build -t 11ty-workflow-example --build-arg SITE_DIRECTORY=dist . + + - name: Set up Docker Compose + uses: docker/compose-action@v1 + with: + compose-file: docker-compose.yml + + - name: Start Docker Compose services + run: docker-compose up -d diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..49712ca --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +# Use a lightweight Node.js runtime as the base image for the final stage +FROM node:14-alpine + +# Set the working directory in the container +WORKDIR /app + +# Copy the compiled site from the build context into the image +ARG SITE_DIRECTORY +COPY $SITE_DIRECTORY ./dist + +# Expose the port your application listens on (if applicable) +# EXPOSE 3000 + +# Define any additional configuration or runtime commands as needed +# ... + +# Example: Start a simple HTTP server to serve the static files +CMD ["npx", "http-server", "dist"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f6cf596 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3' + +services: + web: + image: your-docker-image-name + ports: + - '8086:80' + volumes: + - ./dist:/usr/share/nginx/html:ro \ No newline at end of file