Skip to content

Commit

Permalink
feat: add automation to publish container image (#227)
Browse files Browse the repository at this point in the history
* feat: add automation to publish container image

* chore: updated with PR (#227) feedback

- Only build / release tags
- Be more explicit about COPY syntax
  • Loading branch information
rawkode authored Jun 8, 2021
1 parent d5d3040 commit 99d613b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/publish-container-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: publish-container-image

on:
push:
tags:
- "*"

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: ghcr.io/${{ github.repository_owner }}/pizzly:${{ github.event.ref }}
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


# Build image
FROM node:13.5.0-alpine3.11
FROM node:14-alpine

WORKDIR /app

Expand All @@ -15,11 +15,10 @@ COPY src ./src/
COPY tests ./tests/
COPY views ./views/

RUN yarn install

RUN yarn install && yarn build

# Actual image to run from.
FROM node:13.5.0-alpine3.11
FROM node:14-alpine

# Make sure we have ca certs for TLS
RUN apk --no-cache add ca-certificates
Expand All @@ -34,4 +33,4 @@ COPY --chown=node:node --from=0 /app/dist/ .
COPY --chown=node:node --from=0 /app/views ./views
COPY --chown=node:node --from=0 /app/node_modules ./node_modules

CMD ["node", "src"]
CMD ["node", "./src/index.js"]
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,8 @@
"singleQuote": true,
"printWidth": 120,
"tabWidth": 2
},
"pizzly": {
"uuid": "2f48bd60-4159-4c5d-a540-987f0374d93a"
}
}
}

0 comments on commit 99d613b

Please sign in to comment.