-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from cmusatyalab/master
Add github action to build container and push it to ghcr
- Loading branch information
Showing
2 changed files
with
60 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Create and publish Docker images for tagged versions | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-docker-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log into GHCR | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.output.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,18 @@ | ||
FROM docker.io/library/python:3-alpine | ||
FROM python:3-slim | ||
|
||
LABEL org.opencontainers.image.description='Unwebsockify is a TCP to WebSocket proxy/bridge -- like a reverse websockify.' \ | ||
org.opencontainers.image.source='https://github.com/jimparis/unwebsockify' \ | ||
org.opencontainers.image.licenses='MIT' | ||
|
||
ENV PYTHONDONTWRITEBYTECODE=1 \ | ||
PYTHONFAULTHANDLER=1 \ | ||
PYTHONHASHSEED=random \ | ||
PYTHONUNBUFFERED=1 | ||
|
||
WORKDIR /usr/src/app | ||
RUN pip install --no-cache-dir websockets | ||
COPY unwebsockify.py ./ | ||
ENTRYPOINT [ "python", "-u", "./unwebsockify.py" ] | ||
|
||
COPY requirements.txt . | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
COPY unwebsockify.py . | ||
ENTRYPOINT [ "python", "./unwebsockify.py" ] |