Skip to content

Commit

Permalink
Action to create and push a docker image (#102)
Browse files Browse the repository at this point in the history
* Create docker-image.yml

* Build docker image with Node to enable local reader

* push docker on tag instead of commit

---------

Co-authored-by: Facundo Olano <[email protected]>
  • Loading branch information
julienma and facundoolano authored Jul 14, 2024
1 parent 0c41a3f commit 59be017
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Docker Image CI

on:
push:
tags:
- '*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:

build:

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
FROM node:20-alpine AS node

FROM python:3.11-alpine

# Copy node to python-alpine image
COPY --from=node /usr/lib /usr/lib
COPY --from=node /usr/local/lib /usr/local/lib
COPY --from=node /usr/local/include /usr/local/include
COPY --from=node /usr/local/bin /usr/local/bin

WORKDIR /app

# Install python dependencies
COPY requirements.txt ./

RUN pip install -r requirements.txt

# Install node dependencies
# Copy both package.json and package-lock.json
COPY package*.json ./

RUN npm ci --omit=dev

COPY . .

EXPOSE 9988
Expand Down

0 comments on commit 59be017

Please sign in to comment.