-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (31 loc) · 818 Bytes
/
Copy pathDockerfile
File metadata and controls
40 lines (31 loc) · 818 Bytes
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
FROM golang:latest AS backend
WORKDIR /app
COPY ./back /app
RUN go build -o web .
FROM node:latest AS frontend
WORKDIR /app
COPY ./front /app
RUN npm install
RUN npm run build
FROM ubuntu:latest
WORKDIR /app
COPY --from=frontend /app/dist /var/www/html/
COPY --from=backend /app/web /app/web
COPY init.sql /tmp/init.sql
COPY start.sh /app/start.sh
RUN apt-get update && apt-get install -y nginx mysql-server
RUN service mysql start && \
mysql -u root < /tmp/init.sql && \
echo "server {\n\
listen 80;\n\
server_name _;\n\
root /var/www/html;\n\
location /api/ {\n\
proxy_pass http://127.0.0.1:8080/;\n\
}\n\
}" > /etc/nginx/sites-available/default && \
service mysql stop && \
chmod +x /app/web && \
chmod +x /app/start.sh
EXPOSE 80 3306
CMD ["/app/start.sh"]