diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..c4d7950 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: Test PR + +on: + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Install Dependencies + run: | + cd api + npm install + cd .. + cd frontend-app + npm install + - name: Run Tests + run: | + cd api + npm test + cd .. + cd frontend-app + npm test \ No newline at end of file diff --git a/.gitignore b/.gitignore index 400bc4c..85f09d1 100644 --- a/.gitignore +++ b/.gitignore @@ -104,3 +104,6 @@ dist # TernJS port file .tern-port + +api_data_tmp/ +api_data_upload/ \ No newline at end of file diff --git a/api/Dockerfile b/api/Dockerfile new file mode 100644 index 0000000..0e2d296 --- /dev/null +++ b/api/Dockerfile @@ -0,0 +1,20 @@ +# Set the base image to use for this Docker image +FROM node:14.16.0-alpine + +# Set the working directory for the Docker image +WORKDIR /app + +# Copy the package.json and package-lock.json files into the Docker image +COPY package*.json ./ + +# Install the dependencies in the Docker image +RUN npm install + +# Copy the rest of the application files into the Docker image +COPY . . + +# Set the port that the Docker image will use +EXPOSE 1337 + +# Start the Strapi server when the Docker image runs +CMD ["npm", "start"] diff --git a/api/package.json b/api/package.json index 892bf2b..5557d87 100644 --- a/api/package.json +++ b/api/package.json @@ -7,7 +7,8 @@ "develop": "strapi develop", "start": "strapi start", "build": "strapi build", - "strapi": "strapi" + "strapi": "strapi", + "test": "echo \"No test specified\" && exit 0" }, "dependencies": { "@strapi/plugin-i18n": "4.3.8", diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml new file mode 100644 index 0000000..ba151ef --- /dev/null +++ b/docker-compose.prod.yml @@ -0,0 +1,16 @@ +version: "3" + +services: + strapi: + build: + context: ./api + ports: + - "1337:1337" + volumes: + - ./api_data_upload:/app/public/uploads + - ./api_data_tmp:/app/.tmp + nextjs: + build: + context: ./frontend-app + ports: + - "3000:3000" diff --git a/docker-compose.staging.yml b/docker-compose.staging.yml new file mode 100644 index 0000000..e69de29 diff --git a/frontend-app/Dockerfile b/frontend-app/Dockerfile new file mode 100644 index 0000000..36dc0d7 --- /dev/null +++ b/frontend-app/Dockerfile @@ -0,0 +1,28 @@ +# Base image +FROM node:16-alpine + +# Set working directory +WORKDIR /app + +# Copy package.json and package-lock.json +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy application files +COPY . . + +# Build Next.js application +RUN npm run build + +# Set environment variables +ENV NODE_ENV production +ENV PORT 3000 +ENV NEXT_PUBLIC_API_BASE_URL http://localhost:1337 + +# Expose port +EXPOSE 3000 + +# Start server +CMD ["npm", "start"] \ No newline at end of file diff --git a/frontend-app/package.json b/frontend-app/package.json index 096a839..119dca0 100644 --- a/frontend-app/package.json +++ b/frontend-app/package.json @@ -10,7 +10,8 @@ "dev": "next dev", "build": "next build", "start": "next start", - "lint": "next lint" + "lint": "next lint", + "test": "echo \"No test specified\" && exit 0" }, "dependencies": { "axios": "^0.27.2",