-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (46 loc) · 959 Bytes
/
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
# ======================
# GO FIRST STAGE
# ======================
FROM --platform=linux/amd64 golang:latest as builder
USER ${USER}
WORKDIR /usr/src/app
COPY go.mod \
go.sum ./
RUN go mod download
COPY . ./
ENV GO111MODULE="on" \
GOARCH="amd64" \
GOOS="linux" \
CGO_ENABLED="1"
RUN apt-get clean \
&& apt-get remove
# ======================
# GO FINAL STAGE
# ======================
FROM builder
WORKDIR /usr/src/app
RUN apt-get update \
&& apt-get install -y \
make \
vim \
build-essential \
git \
python3 python3-pip \
python3-requests \
sqlite3 libsqlite3-dev
RUN pip install --break-system-packages \
sqlite3-to-mysql \
mysql-connector \
aiohttp
COPY --from=builder . ./usr/src/app
ARG PORT=4000
ARG BABELCDB_PATH=./data/BabelCDB
ARG DB_HOST=127.0.0.1
ARG DB_PORT=3306
ARG DB_USER=root
ARG DB_PASSWORD=123456
ARG DB_NAME=railway
RUN make upsert-data
RUN make goprod
EXPOSE $PORT
CMD ["sh", "-c", "./run_server.sh"]