-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
015dba9
commit 1e047dd
Showing
2 changed files
with
80 additions
and
0 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,63 @@ | ||
# When copying this to make a new file | ||
# copy and replace all occurrences of the following: | ||
# ############ | ||
name: Build and push username-1 Docker | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ master ] | ||
# Publish semver tags as releases. | ||
tags: [ 'v*.*.*' ] | ||
# Skip build unless these paths have changed | ||
paths: | ||
- 'username-1/**' | ||
- '.github/workflows/username-1.yml' | ||
|
||
env: | ||
# Use docker.io for Docker Hub if empty | ||
REGISTRY: ghcr.io | ||
# github.repository as <account>/<repo> | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
|
||
jobs: | ||
build: | ||
name: Build and push username-1 | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
# https://github.com/easimon/maximize-build-space/blob/master/action.yml | ||
- name: Maximize build space | ||
run: | | ||
sudo rm -rf /usr/share/dotnet | ||
sudo rm -rf /usr/local/lib/android | ||
sudo rm -rf /opt/ghc | ||
sudo rm -rf /opt/hostedtoolcache/CodeQL | ||
sudo docker image prune --all --force | ||
- name: Get dockerfile repo | ||
uses: actions/checkout@v3 | ||
|
||
# Login against a Docker registry except on PR | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push image | ||
working-directory: ./username-1 | ||
run: | | ||
TAG=$(date -u +%Y%m%d%H%M%S) | ||
docker build . --tag ghcr.io/${{github.repository}}/username-1:$TAG | ||
docker push ghcr.io/${{github.repository}}/username-1:$TAG | ||
docker tag ghcr.io/${{github.repository}}/username-1:$TAG ghcr.io/${{github.repository}}/username-1:latest | ||
docker push ghcr.io/${{github.repository}}/username-1:latest |
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,17 @@ | ||
FROM ubuntu:focal-20240123 as base | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
RUN apt-get update && \ | ||
apt-get upgrade -y && \ | ||
apt-get install -y tar python3 nano sudo jq \ | ||
&& apt-get autoremove -y && \ | ||
apt-get clean | ||
|
||
ARG username=github | ||
RUN useradd -ms /bin/bash ${username} | ||
RUN echo "%${username} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
USER ${username} | ||
ENV HOME=/home/${username} | ||
|
||
WORKDIR $HOME |