Skip to content

Commit

Permalink
Add Docker support #1.
Browse files Browse the repository at this point in the history
Will add image on docker hub soon.
  • Loading branch information
sn123 committed May 11, 2020
1 parent e31206f commit b555e48
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.exe
js/
css/
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM node:14-alpine AS node
LABEL maintainer="Goavega Open Source Team <[email protected]>"
ENV BUILD_DIR /home/

RUN set -ex && \
apk add yarn
COPY ./ ${BUILD_DIR}
WORKDIR ${BUILD_DIR}client
RUN set -ex && \
yarn install && \
yarn prod

FROM golang:1.14-alpine AS go
ENV APP_DIR /var/www/
ENV BUILD_DIR /home/
RUN set -ex && \
mkdir -p ${APP_DIR}js/ && \
mkdir -p ${APP_DIR}css/ && \
mkdir -p ${APP_DIR}views/
COPY --from=node /home/js/* ${APP_DIR}js/
COPY --from=node /home/css/* ${APP_DIR}css/
COPY --from=node /home/views/* ${APP_DIR}views/
COPY ./ ${BUILD_DIR}
WORKDIR ${BUILD_DIR}
RUN set -ex && \
go build ./ && \
cp ./mustard ${APP_DIR}

FROM alpine:latest
ENV APP_DIR /var/www/
ENV PORT 80

COPY --from=go ${APP_DIR} ${APP_DIR}
COPY ./dockersupport/start.sh /usr/local/bin/
WORKDIR ${APP_DIR}
RUN set -ex && \
chmod u+x ./mustard && \
chmod u+x /usr/local/bin/start.sh
EXPOSE ${PORT}
CMD ["start.sh"]
2 changes: 1 addition & 1 deletion client/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const BaseUrl = "http://localhost:8090/";
export const BaseUrl = "/";
4 changes: 4 additions & 0 deletions dockersupport/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
echo 'INFO: starting mustard'
cd ${APP_DIR} && ./mustard
echo 'INFO: Nothing to see here, move along'

0 comments on commit b555e48

Please sign in to comment.