Push to github container registry

This commit is contained in:
Daniel Bulant 2023-05-28 14:03:29 +02:00
parent 267b3cd850
commit 905e44ce8f
2 changed files with 12 additions and 5 deletions

View file

@ -3,16 +3,20 @@ name: Docker Image CI
on: on:
push: push:
branches: [ "master" ] branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Login to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build the Docker image - name: Build the Docker image
run: docker build . --file Dockerfile --tag tcp-spawner:$(date +%s) run: docker build . --file Dockerfile --tag ghcr.io/danbulant/tcp-spawner:latest
- name: Tag the docker image (date)
run: docker tag ghcr.io/danbulant/tcp-spawner:latest ghcr.io/danbulant/tcp-spawner:$(date --iso-8601)
- name: Publish the Docker image
run: docker push ghcr.io/danbulant/tcp-spawner:$(date --iso-8601)
- name: Publish the Docker image
run: docker push ghcr.io/danbulant/tcp-spawner:latest

View file

@ -29,4 +29,7 @@ COPY --from=builder /usr/src/app/target/x86_64-unknown-linux-musl/release/tcp-sp
EXPOSE 1337 EXPOSE 1337
LABEL org.opencontainers.image.source=https://github.com/danbulant/ctf-tcp-server
LABEL org.opencontainers.image.description="A simple TCP process spawner written in Rust."
CMD ["tcp-spawner", "0.0.0.0:1337", "sh"] CMD ["tcp-spawner", "0.0.0.0:1337", "sh"]