Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docker): build on docker #1065

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[Dockerfile]
indent_size = 4
indent_style = tab

[Makefile]
indent_size = 8
indent_style = tab
Expand Down
32 changes: 0 additions & 32 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ on:
push:
branches: [main]

env:
LIBAOM_VERSION: 3.8.0
LIBWEBP_VERSION: 1.3.2

jobs:
release-please:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -54,34 +50,6 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y yasm
- name: Install libwebp
run: |
mkdir -p /tmp/src
cd /tmp/src
wget -O libwebp.tar.gz https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${LIBWEBP_VERSION}.tar.gz
tar -xzf libwebp.tar.gz -C /tmp/src
rm libwebp.tar.gz
cd /tmp/src/libwebp-${LIBWEBP_VERSION}
./configure --prefix /tmp/libwebp
make -j4
make install
- name: Install libaom
run: |
mkdir -p /tmp/src
cd /tmp/src
wget -O libaom.tar.gz https://storage.googleapis.com/aom-releases/libaom-${LIBAOM_VERSION}.tar.gz
mkdir -p /tmp/src/libaom-${LIBAOM_VERSION}
tar -xzf libaom.tar.gz -C /tmp/src
rm libaom.tar.gz
mkdir -p /tmp/src/aom_build
cd /tmp/src/aom_build
cmake /tmp/src/libaom-${LIBAOM_VERSION} -DCMAKE_INSTALL_PREFIX=/tmp/libaom
make -j4
make install
- env:
CGO_CFLAGS: -I/tmp/libwebp/include -I/tmp/libaom/include
CGO_LDFLAGS: -L/tmp/libwebp/lib -lwebp -L/tmp/libaom/lib -laom -lm
Expand Down
46 changes: 44 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
FROM gcr.io/distroless/base
COPY manael /
# Start by building the application.
FROM golang:1.21.5-bookworm as build

ENV LIBAOM_VERSION 3.8.0
ENV LIBWEBP_VERSION 1.3.2

RUN \
sudo apt-get update \
sudo apt-get install -y yasm \
\
mkdir -p /tmp/src \
cd /tmp/src \
wget -O libwebp.tar.gz https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${LIBWEBP_VERSION}.tar.gz \
tar -xzf libwebp.tar.gz -C /tmp/src \
rm libwebp.tar.gz \
cd /tmp/src/libwebp-${LIBWEBP_VERSION} \
./configure --prefix /tmp/libwebp \
make -j4 \
make install \
\
mkdir -p /tmp/src \
cd /tmp/src \
wget -O libaom.tar.gz https://storage.googleapis.com/aom-releases/libaom-${LIBAOM_VERSION}.tar.gz \
mkdir -p /tmp/src/libaom-${LIBAOM_VERSION} \
tar -xzf libaom.tar.gz -C /tmp/src \
rm libaom.tar.gz \
mkdir -p /tmp/src/aom_build \
cd /tmp/src/aom_build \
cmake /tmp/src/libaom-${LIBAOM_VERSION} -DCMAKE_INSTALL_PREFIX=/tmp/libaom \
make -j4 \
make install

WORKDIR /go/src/manael
COPY . .

ENV CGO_CFLAGS -I/tmp/libwebp/include -I/tmp/libaom/include
ENV CGO_LDFLAGS -L/tmp/libwebp/lib -lwebp -L/tmp/libaom/li -laom -lm

RUN go mod download
RUN go build -o /go/bin/manael

# Now copy it into our base image.
FROM gcr.io/distroless/static-debian12
COPY --from=build /go/bin/manael /
CMD ["/manael"]