Skip to content

Commit

Permalink
add docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
garrappachc committed Nov 13, 2023
1 parent 8328686 commit 027cab7
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.git
.github
.svelte-kit
.vscode
.yarn/*
node_modules
tests
.eslintignore
.eslintrc.cjs
.gitignore
.npmrc
.prettierignore
.prettierrc
.stylelintrc.json
.yarnrc.yml
playwright.config.ts
renovate.json

!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
branches:
- 'master'

env:
REGISTRY: ghcr.io

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -28,3 +31,40 @@ jobs:

- name: Build
run: yarn build

build-docker-image:
runs-on: ubuntu-latest

strategy:
matrix:
include:
- branding: tf2pickup.pl

- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/tf2pickup-org/${{ matrix.branding }}

- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

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

- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
push: true
build-args: |
branding=${{ matrix.branding }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}

- name: Print image digest
run: echo ${{ steps.docker_build.outputs.digest }}
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:lts-alpine
WORKDIR /app

ARG branding=tf2pickup.pl

COPY . .
RUN yarn install --immutable
RUN yarn build:${branding}

USER node
CMD [ "node", "build/index.js" ]

EXPOSE 3000

0 comments on commit 027cab7

Please sign in to comment.