diff --git a/.github/workflows/build-docker.yaml b/.github/workflows/build-docker.yaml new file mode 100644 index 00000000..f4d06f41 --- /dev/null +++ b/.github/workflows/build-docker.yaml @@ -0,0 +1,16 @@ +name: build publish image to docker to DockerHub +on: + [workflow_dispatch] + +jobs: + publish_images: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + - name: build image + run: docker build ./api/ -t zennnnnnnnnn/devops-qr-code-api:latest + - name: push image to DockerHub + run: | + docker push zennnnnnnnnn/devops-qr-code-api:latest + diff --git a/api/Dockerfile b/api/Dockerfile new file mode 100644 index 00000000..efa73973 --- /dev/null +++ b/api/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.9 + +WORKDIR /usr/src/app + +COPY requirements.txt ./ + +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +CMD [ "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80" ] \ No newline at end of file diff --git a/front-end-nextjs/Dockerfile b/front-end-nextjs/Dockerfile new file mode 100644 index 00000000..1ace9d51 --- /dev/null +++ b/front-end-nextjs/Dockerfile @@ -0,0 +1,20 @@ +FROM node:18-alpine AS base + +WORKDIR /app + +COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ + +RUN \ + if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ + elif [ -f package-lock.json ]; then npm ci; \ + elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \ + else echo "Lockfile not found." && exit 1; \ + fi + +COPY . . + +RUN npm run build + +EXPOSE 3000 + +CMD ["npm", "start"] \ No newline at end of file