Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

Commit 69d74e4

Browse files
committed
Initial commit
0 parents  commit 69d74e4

3 files changed

Lines changed: 121 additions & 0 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Image build
2+
3+
on:
4+
push:
5+
tags:
6+
- '*' # Push events to matching v*, i.e. v1.0, v20.15.10
7+
jobs:
8+
buildx:
9+
runs-on: ubuntu-latest
10+
steps:
11+
-
12+
name: Checkout
13+
uses: actions/checkout@v2
14+
- name: Get the version
15+
id: get_version
16+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
17+
-
18+
name: Set up Docker Buildx
19+
id: buildx
20+
uses: docker/setup-buildx-action@v1
21+
with:
22+
driver-opts: network=host
23+
24+
-
25+
name: Cache Docker layers
26+
uses: actions/cache@v2
27+
with:
28+
path: /tmp/.buildx-cache
29+
key: ${{ runner.os }}-buildx-${{ github.sha }}
30+
restore-keys: |
31+
${{ runner.os }}-buildx-
32+
33+
-
34+
name: docker_build
35+
uses: docker/build-push-action@v2
36+
37+
with:
38+
context: .
39+
file: ./Dockerfile
40+
platforms: linux/amd64
41+
tags: localhost:5000/portainer/portainer-docker-compose:latest
42+
cache-from: type=local,src=/tmp/.buildx-cache
43+
cache-to: type=local,dest=/tmp/.buildx-cache
44+
build-args: |
45+
DOCKER_COMPOSE_VER=${{ steps.get_version.outputs.VERSION }}
46+
47+
outputs:
48+
"type=local,dest=/tmp"
49+
- uses: actions/upload-artifact@v2
50+
with:
51+
name: docker-compose
52+
path: /tmp/docker-compose
53+
if-no-files-found: error
54+
- name: Create Release
55+
id: create_release
56+
uses: actions/create-release@v1
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
with:
60+
tag_name: ${{ github.ref }}
61+
release_name: Release ${{ github.ref }}
62+
draft: false
63+
prerelease: false
64+
- name: Upload Release Asset
65+
id: upload-release-asset
66+
uses: actions/upload-release-asset@v1
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
with:
70+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
71+
asset_path: /tmp/docker-compose
72+
asset_name: docker-compose
73+
asset_content_type: application/binary

Dockerfile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Dockerfile to build docker-compose for linux amd64
2+
FROM python:3.6.5-stretch as builder
3+
# Add env
4+
ENV LANG C.UTF-8
5+
6+
RUN apt-get update && apt-get install -qq --no-install-recommends unzip patchelf
7+
8+
# Set the versions
9+
ARG DOCKER_COMPOSE_VER=1.27.4
10+
# docker-compose requires pyinstaller 3.5 (check github.com/docker/compose/requirements-build.txt)
11+
# If this changes, you may need to modify the version of "six" below
12+
ENV PYINSTALLER_VER 3.5
13+
# "six" is needed for PyInstaller. v1.11.0 is the latest as of PyInstaller 3.5
14+
ENV SIX_VER 1.11.0
15+
16+
# Install dependencies
17+
RUN pip install --upgrade pip
18+
RUN pip install six==$SIX_VER
19+
RUN pip install staticx
20+
21+
# Compile the pyinstaller "bootloader"
22+
# https://pyinstaller.readthedocs.io/en/stable/bootloader-building.html
23+
WORKDIR /build/pyinstallerbootloader
24+
RUN curl -fsSL https://github.com/pyinstaller/pyinstaller/releases/download/v$PYINSTALLER_VER/PyInstaller-$PYINSTALLER_VER.tar.gz | tar xvz >/dev/null \
25+
&& cd PyInstaller*/bootloader \
26+
&& python3 ./waf all
27+
28+
# Clone docker-compose
29+
WORKDIR /build/dockercompose
30+
RUN curl -fsSL https://github.com/docker/compose/archive/$DOCKER_COMPOSE_VER.zip > $DOCKER_COMPOSE_VER.zip \
31+
&& unzip $DOCKER_COMPOSE_VER.zip
32+
33+
# Run the build steps (taken from https://github.com/docker/compose/blob/master/script/build/linux-entrypoint)
34+
RUN cd compose-$DOCKER_COMPOSE_VER && mkdir ./dist \
35+
&& pip install -r requirements.txt -r requirements-build.txt
36+
37+
RUN cd compose-$DOCKER_COMPOSE_VER \
38+
&& echo "unknown" > compose/GITSHA \
39+
&& pyinstaller -F docker-compose.spec \
40+
&& mkdir /dist \
41+
&& staticx -l /lib/x86_64-linux-gnu/libgcc_s.so.1 dist/docker-compose /dist/docker-compose
42+
43+
FROM scratch
44+
45+
COPY --from=builder /dist/docker-compose /docker-compose
46+
47+
entrypoint ["/docker-compose"]

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# docker-compose-linux-amd64-binary

0 commit comments

Comments
 (0)