-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
66 lines (51 loc) · 1.76 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
FROM golang:1.9 AS builder
# switch the shell used by RUN from sh to bash
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
ENV HOME /root
ENV GOPATH $HOME/go
ENV PROJECT_DIR $GOPATH/src/github.com/decaf-emu/huehuetenango
# copy the project files
RUN mkdir -p $PROJECT_DIR
COPY . $PROJECT_DIR
WORKDIR /root/go/src/github.com/decaf-emu/huehuetenango
# install nvm
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
# install node
ENV NVM_DIR $HOME/.nvm
ENV NPM_DIR $HOME/.npm
ENV YARN_DIR $HOME/.yarn
ENV PATH $YARN_DIR/bin:$GOPATH/bin:$PATH
RUN source $NVM_DIR/nvm.sh && \
cd static && \
nvm install
# install yarn
RUN source $NVM_DIR/nvm.sh && \
curl -o- -L https://yarnpkg.com/install.sh | bash
# build huehuetenango
RUN source $NVM_DIR/nvm.sh && \
cd static && \
nvm use && \
cd .. && \
make
FROM ubuntu:latest
ENV OUTPUT_DIR /opt/huehuetenango
ENV DATA_DIR /data/huehuetenango
# create the huehuetenango user
RUN mkdir -p $OUTPUT_DIR && \
mkdir -p $DATA_DIR && \
groupadd -r huehuetenango && \
useradd -r -u 528 -g huehuetenango -d $OUTPUT_DIR -s /sbin/nologin huehuetenango && \
chown -R 528:huehuetenango $OUTPUT_DIR $DATA_DIR && \
chmod 775 $OUTPUT_DIR $DATA_DIR
VOLUME /data
# copy and assign permissions to the build files
RUN mkdir -p $OUTPUT_DIR
COPY --from=builder /root/go/src/github.com/decaf-emu/huehuetenango/huehuetenango /opt/huehuetenango/huehuetenango
COPY --from=builder /root/go/src/github.com/decaf-emu/huehuetenango/static/dist /opt/huehuetenango/static
RUN chown -R huehuetenango:huehuetenango $OUTPUT_DIR
RUN apt-get update && \
apt-get install -y ca-certificates supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
USER huehuetenango
WORKDIR $OUTPUT_DIR
CMD ["/usr/bin/supervisord"]