forked from simulationcraft/simc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
73 lines (63 loc) · 2.29 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
###
# SimulationCraft docker image
#
# Available build-arg:
# - THREADS=[int] Default 1, provide a value for -j
# - NONETWORKING=[0|1] Default 0, 0 - armory can be used if an api-key is provided, 1 - no import capabilities
#
# Example usage:
# - creating the image (note the dot!)
# docker build --build-arg THREADS=2 --build-arg NONETWORKING=1 -t simulationcraft .
# ^ your intended thread count to optimize simc for
# ^ name of the image
# - run the image
# docker run simulationcraft ./simc spell_query=spell.name=frost_shock
# ^ start of the command
#
# To reduce the footprint of this image all SimulationCraft files are
# removed except for the following files and directories (including
# their files)
# - ./simc
# - ./profiles/*
#
# base image
FROM alpine:latest AS build
ARG THREADS=1
ARG NONETWORKING=0
COPY . /app/SimulationCraft/
# install SimulationCraft
RUN apk --no-cache add --virtual build_dependencies \
curl-dev \
g++ \
git \
libcurl \
make && \
if [ $NONETWORKING -eq 0 ] ; then \
echo "Building networking version" && \
make -C /app/SimulationCraft/engine optimized -j $THREADS LTO_THIN=1 OPTS+="-Os -mtune=native" ; \
else \
echo "Building no-networking version" && \
make -C /app/SimulationCraft/engine optimized -j $THREADS LTO_THIN=1 SC_NO_NETWORKING=1 OPTS+="-Os -mtune=native" ; \
fi && \
apk del build_dependencies
# disable ptr to reduce build size
# sed -i '' -e 's/#define SC_USE_PTR 1/#define SC_USE_PTR 0/g' engine/dbc.hpp
# fresh image to reduce size
FROM alpine:latest
ARG NONETWORKING=0
RUN if [ $NONETWORKING -eq 0 ] ; then \
echo "Preparing for networking" && \
apk --no-cache add --virtual build_dependencies \
libcurl \
libgcc \
libstdc++ ; \
else \
echo "Preparing for no-networking" && \
apk --no-cache add --virtual build_dependencies \
libgcc \
libstdc++ ; \
fi
# get compiled simc and profiles
COPY --from=build /app/SimulationCraft/engine/simc /app/SimulationCraft/
COPY --from=build /app/SimulationCraft/profiles/ /app/SimulationCraft/profiles/
WORKDIR /app/SimulationCraft