Skip to content

Commit

Permalink
Add Dockerfile and GH action to push to Docker Hub
Browse files Browse the repository at this point in the history
  • Loading branch information
kuylar committed Sep 13, 2024
1 parent 9153a7d commit f7bbdc7
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: publish-to-docker

on:
push:
branches:
- "mistress"

jobs:
publish:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Check out code

- name: Set version
run: echo VERSION=`date +%Y%m%d` >> $GITHUB_ENV
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build and push
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64
tags: ${{ secrets.DOCKER_USERNAME }}/pot_generator:latest,${{ secrets.DOCKER_USERNAME }}/pot_generator:${{ env.VERSION }}
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:18.20.4-alpine3.20
RUN mkdir -p /opt/app
WORKDIR /opt/app
COPY package.json package-lock.json index.js LICENSE .
RUN npm install
EXPOSE 3000
CMD [ "node", "index.js" ]

0 comments on commit f7bbdc7

Please sign in to comment.