Skip to content

Commit

Permalink
fix(docker): build on docker
Browse files Browse the repository at this point in the history
  • Loading branch information
ykzts committed Dec 20, 2023
1 parent 52c6010 commit 9a90c63
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 34 deletions.
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"]

0 comments on commit 9a90c63

Please sign in to comment.