-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
73 lines (55 loc) · 2.09 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
### Dockerfile for Mollufier ###
## FRONTEND BUILDER ##
# Use Debian Bullseye based Node.js 20 LTS image
FROM node:20-bullseye-slim AS builder
# Buid arguments
ARG FE_PUBLIC_PATH="/"
ENV PUBLIC_PATH=${FE_PUBLIC_PATH}
ARG FE_BACKEND_BASE_URL="/api"
ENV BACKEND_BASE_URL=${FE_BACKEND_BASE_URL}
ARG FE_GA_MEASUREMENT_ID=""
ENV GA_MEASUREMENT_ID=${FE_GA_MEASUREMENT_ID}
# Install Node.js global dependencies
RUN npm install -f --location=global yarn @vue/cli
# Working directory
WORKDIR /build
# Copy frontend sources and create .env.local
COPY frontend .
RUN touch .env.local; \
echo "VUE_APP_BACKEND_BASE_URL=\"${BACKEND_BASE_URL}\"" >> .env.local; \
echo "VUE_APP_GA_MEASUREMENT_ID=\"${GA_MEASUREMENT_ID}\"" >> .env.local
# Do build
RUN yarn install
RUN rm -rf ./dist && yarn build --mode production
## SERVICE CONTAINER ##
# Use Debian Bullseye based Node.js 20 LTS image
# We can't use Alpine based image due to error with Kiwi dependency installation
FROM node:20-bullseye-slim AS runner
# Container labels
LABEL org.opencontainers.image.title="Mollufier"
LABEL org.opencontainers.image.description="Mollufies sentences using Korean tokenizer"
LABEL org.opencontainers.image.authors="somni <[email protected]>"
LABEL org.opencontainers.image.url="https://github.com/somnisomni/mollufier"
LABEL org.opencontainers.image.documentation="https://github.com/somnisomni/mollufier"
LABEL org.opencontainers.image.source="https://github.com/somnisomni/mollufier"
LABEL org.opencontainers.image.licenses="MIT"
# Install Python 3
RUN apt-get -y update \
&& apt-get install -y python3 python3-pip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js global dependencies
RUN npm install -f --location=global http-server
# Working directory
WORKDIR /app
# Copy service files to app directory
RUN mkdir -p backend && mkdir -p frontend
COPY backend backend
COPY --from=builder /build/dist frontend
# Install backend dependencies
RUN pip3 install -r ./backend/requirements.txt
# Entrypoint / CMD
COPY container-entrypoint.sh .
ENTRYPOINT ["/bin/bash", "container-entrypoint.sh"]
# Exposes
EXPOSE 8080 8081