Skip to content

Commit

Permalink
BUILD - Optimize Dockerfile by using alpine as base image (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
yungcomputerchair committed Oct 29, 2024
2 parents ae327cc + 352fa8a commit 1543dac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
# build
FROM debian:stable-slim AS build
FROM alpine:3 as build

Check warning on line 2 in Dockerfile

View workflow job for this annotation

GitHub Actions / Push Docker Image

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

WORKDIR /usr/src/app

RUN apt-get -y update && apt-get install -y \
RUN apk update && apk upgrade && apk add \
linux-headers \
git \
clang \
clang18 \
make \
libsqlite3-dev
sqlite-dev

COPY src ./src
COPY vendor ./vendor
COPY .git ./.git
COPY Makefile CMakeLists.txt version.h.in ./

RUN sed -i 's/^CC=clang$/&-18/' Makefile
RUN sed -i 's/^CXX=clang++$/&-18/' Makefile

RUN make nosandbox -j$(nproc)

# prod
FROM debian:stable-slim
FROM alpine:3

WORKDIR /usr/src/app

RUN apt-get -y update && apt-get install -y \
libsqlite3-dev
RUN apk update && apk upgrade && apk add \
libstdc++ \
sqlite-dev

COPY --from=build /usr/src/app/bin/fusion /bin/fusion
COPY sql ./sql
Expand All @@ -31,6 +36,6 @@ CMD ["/bin/fusion"]

EXPOSE 23000/tcp
EXPOSE 23001/tcp
EXPOSE 8001/tcp
EXPOSE 8003/tcp

LABEL Name=openfusion Version=1.6.0
2 changes: 2 additions & 0 deletions src/settings.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once

#include <stdint.h>
#include <string>
#include <time.h>

namespace settings {
extern int VERBOSITY;
Expand Down

0 comments on commit 1543dac

Please sign in to comment.