diff --git a/.github/workflows/pushimage.yml b/.github/workflows/pushimage.yml new file mode 100644 index 0000000..2d9c1c4 --- /dev/null +++ b/.github/workflows/pushimage.yml @@ -0,0 +1,26 @@ +name: Build and Push Docker Image +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.G_TOKEN }} + + - name: Build and Push Docker image + run: | + IMAGE_TAG=ghcr.io/rohanrusta21/github-readme:latest + docker build --file Dockerfile --tag $IMAGE_TAG . + docker push $IMAGE_TAG diff --git a/.gitignore b/.gitignore index 4d29575..3b304f7 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ /node_modules /.pnp .pnp.js +package-*.json # testing /coverage diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2e61f46 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM node:18 +LABEL maintainer="Rohan Rustagi" +WORKDIR /app +COPY package.json ./ +COPY package*.json ./ +RUN npm install --no-optional +COPY . . +EXPOSE 3000 +CMD [ "npm", "start" ]