Skip to content

Commit 0843b3b

Browse files
31chtumaisch
authored andcommitted
GitHub actions: add Docker image build
1 parent d43d038 commit 0843b3b

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://github.com/devcontainers/images/tree/main/src/cpp
22
FROM mcr.microsoft.com/devcontainers/cpp:1-debian-12
33

4-
# [Optional] Uncomment this section to install additional packages.
4+
# Install additional packages
55
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
66
&& apt-get -y install --no-install-recommends \
77
clang-format \
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build and publish Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- ".devcontainer/Dockerfile"
9+
pull_request:
10+
branches:
11+
- main
12+
paths:
13+
- ".devcontainer/Dockerfile"
14+
15+
jobs:
16+
build-and-publish:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v3
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Log in to GitHub Container Registry
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ghcr.io
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Build and push Docker image
34+
uses: docker/build-push-action@v6
35+
with:
36+
context: "{{defaultContext}}:.devcontainer"
37+
push: true
38+
tags: ghcr.io/${{ github.repository_owner }}/project-cplusplus:latest

0 commit comments

Comments
 (0)