Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
d830676408
|
|||
48dda3455b
|
|||
b4e9d9ec58
|
|||
4e1dc58611
|
|||
21040eaa65
|
|||
bf978b222b
|
|||
c7e5ae7513
|
|||
b22fd7cdfc
|
|||
829167d269
|
|||
6590e5bd40
|
@@ -17,3 +17,5 @@ RUN mkdir /home/container && chmod 0777 /home/container
|
|||||||
ENV HOME=/home/container
|
ENV HOME=/home/container
|
||||||
ENV GOPATH=/home/container/go
|
ENV GOPATH=/home/container/go
|
||||||
ENV GOCACHE=/home/container/.cache
|
ENV GOCACHE=/home/container/.cache
|
||||||
|
|
||||||
|
ENTRYPOINT ["/src/entrypoint.sh"]
|
||||||
|
10
README.md
10
README.md
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
Docker image with everything you might need for developing apps in Go.
|
Docker image with everything you might need for developing apps in Go.
|
||||||
|
|
||||||
**Note that for newer mac hardware you have to use Docker Desktop or amd64 virtual machine in lima/other tools!**
|
|
||||||
|
|
||||||
## What's inside
|
## What's inside
|
||||||
|
|
||||||
Debian 12 (slim) is used as base image.
|
Debian 12 (slim) is used as base image.
|
||||||
@@ -18,6 +16,14 @@ Debian 12 (slim) is used as base image.
|
|||||||
| `go-junit-report` | 2.1.0 | go-junit-report | [External link](https://github.com/jstemmer/go-junit-report) |
|
| `go-junit-report` | 2.1.0 | go-junit-report | [External link](https://github.com/jstemmer/go-junit-report) |
|
||||||
| `delve` | 1.22.1 | delve | [External link](https://github.com/go-delve/delve) |
|
| `delve` | 1.22.1 | delve | [External link](https://github.com/go-delve/delve) |
|
||||||
|
|
||||||
|
## Multiarch support
|
||||||
|
|
||||||
|
This image contains versions for both amd64 (AMD/Intel CPUs and their clones) and arm64 (Rockchips, Apple Silicon and so on).
|
||||||
|
|
||||||
|
Note, that **amd64** image built on my CI server, while **arm64** image I building on my local machine with `built_multiarch.sh`
|
||||||
|
for each published tag. It is because I have no separate arm64 machine (yet) and it's emulation on my server's CPU is freaking
|
||||||
|
slow (imagine Linux installation is going for three whole hours!).
|
||||||
|
|
||||||
## HOME
|
## HOME
|
||||||
|
|
||||||
Home directory is `/home/container`.
|
Home directory is `/home/container`.
|
||||||
|
14
action.yml
Normal file
14
action.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# action.yml
|
||||||
|
name: "Go Toolbox"
|
||||||
|
description: "A toolbox for golang applications development."
|
||||||
|
author: "Stanislav N. aka pztrn"
|
||||||
|
inputs:
|
||||||
|
command:
|
||||||
|
description: "Command to run."
|
||||||
|
required: true
|
||||||
|
default: "task -l"
|
||||||
|
runs:
|
||||||
|
using: "docker"
|
||||||
|
image: "Dockerfile"
|
||||||
|
args:
|
||||||
|
- ${{ inputs.command }}
|
30
build_multiarch.sh
Executable file
30
build_multiarch.sh
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This script builds arm64 toolbox image, pushes it to packages and create version manifest with
|
||||||
|
# both amd64 and arm64 images.
|
||||||
|
# This script is launched on my local machine (which is macbook with M2 Pro CPU) and uses
|
||||||
|
# lima with arm64 version of Docker.
|
||||||
|
|
||||||
|
IMAGE_NAME="code.pztrn.name/containers/go-toolbox"
|
||||||
|
VERSION=$1
|
||||||
|
|
||||||
|
if [ "${VERSION}" == "" ]; then
|
||||||
|
echo "! No version specified as first argument!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "* Building multiarch image with amd64 and arm64 images for version '${VERSION}'..."
|
||||||
|
echo "* Pulling ${IMAGE_NAME}:${VERSION} (amd64)..."
|
||||||
|
docker pull "${IMAGE_NAME}:${VERSION}"
|
||||||
|
echo "* Retagging pulled image as ${IMAGE_NAME}:${VERSION}-amd64..."
|
||||||
|
docker image tag "${IMAGE_NAME}:${VERSION}" "${IMAGE_NAME}:${VERSION}-amd64"
|
||||||
|
echo "* Pushing ${IMAGE_NAME}:${VERSION}-amd64..."
|
||||||
|
docker push "${IMAGE_NAME}:${VERSION}-amd64"
|
||||||
|
echo "* Building arm64 version..."
|
||||||
|
docker build -t "${IMAGE_NAME}:${VERSION}-arm64" .
|
||||||
|
echo "* Pushing arm64 image..."
|
||||||
|
docker push "${IMAGE_NAME}:${VERSION}-arm64"
|
||||||
|
echo "* Creating multiarch manifest..."
|
||||||
|
docker manifest create "${IMAGE_NAME}:${VERSION}" "${IMAGE_NAME}:${VERSION}-amd64" "${IMAGE_NAME}:${VERSION}-arm64"
|
||||||
|
echo "* Pushing multiarch manifest as ${IMAGE_NAME}:${VERSION}..."
|
||||||
|
docker manifest push "${IMAGE_NAME}:${VERSION}"
|
23
entrypoint.sh
Executable file
23
entrypoint.sh
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Entrypoint that handles both GitHub/Gitea actions things and direct commands execution.
|
||||||
|
CMD=$*
|
||||||
|
|
||||||
|
# Just ensure we have PATH defined properly.
|
||||||
|
PATH="${PATH}:/usr/bin/:/usr/sbin/:/bin/:/usr/local/bin/:/opt/bin/"
|
||||||
|
|
||||||
|
if [ "${CMD}" == "" ]; then
|
||||||
|
CMD="${INPUT_COMMAND}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${CMD}" == "" ]; then
|
||||||
|
echo "! No command to run!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "----------"
|
||||||
|
echo "Launching command:"
|
||||||
|
echo "${CMD}"
|
||||||
|
echo "----------"
|
||||||
|
|
||||||
|
${CMD}
|
Reference in New Issue
Block a user