Skip to content

Commit

Permalink
Update dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Berhent committed Sep 3, 2022
1 parent e0887ba commit 3e6e283
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
22 changes: 6 additions & 16 deletions server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
FROM appditto/imagemagick_go:latest as base

FROM base as builder
FROM appditto/libvips:latest

WORKDIR /root

Expand All @@ -9,21 +7,13 @@ ADD . .
# add assets
ADD assets assets
# Dependencies and buil
# Install dependencies, imagemagick, go, and cleanup
RUN apt-get update && apt-get install -y \
gcc pkg-config \
&& go get \
&& echo "Building natricon" \
&& go build -o natricon \
&& rm -rf /var/lib/apt/lists/*

# Copy binary to imagemagick image
FROM appditto/imagemagick:latest
# Install dependencies, libvips, go, and cleanup
RUN go get \
&& go build -o natricon

USER root
WORKDIR /root
ENV ENVIRONMENT "production"

COPY --from=builder /root/natricon /usr/bin/natricon
ENV MALLOC_ARENA_MAX=2

ENV GIN_MODE="release"

Expand Down
6 changes: 6 additions & 0 deletions server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/golang/glog"
socketio "github.com/googollee/go-socket.io"
"github.com/h2non/bimg"
"github.com/jasonlvhit/gocron"
"gopkg.in/gographics/imagick.v3/imagick"
)
Expand Down Expand Up @@ -120,6 +121,11 @@ func main() {

// Setup channel for stats processing job
statsChan := make(chan *gin.Context, 100)
// Setup libvips
bimg.Initialize()
bimg.VipsCacheSetMaxMem(0)
bimg.VipsCacheSetMax(0)
defer bimg.Shutdown()

// Setup natricon controller
natriconController := controller.NatriconController{
Expand Down

0 comments on commit 3e6e283

Please sign in to comment.