Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create dockerfile to build image #42

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/node_modules
46 changes: 46 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# syntax = docker/dockerfile:1.4

# BUILD FRONTEND STAGE
trungdlp-wolffun marked this conversation as resolved.
Show resolved Hide resolved
FROM node:16-alpine as frontend-builder
WORKDIR /app

# Install Make
RUN apk add --no-cache make

# Install Yarn v3
RUN corepack enable
RUN corepack prepare yarn@stable --activate
RUN yarn set version stable

# Copy and install deps
COPY --link Makefile .
COPY --link web web
RUN make web/install-deps

# Copy all file
COPY --link . .

# Build frontend
RUN make web/build

# BUILD BACKEND STAGE
FROM golang:1.18 as backend-builder
WORKDIR /app
COPY --link go.mod go.sum ./
RUN go mod download
COPY --link . .
COPY --link --from=frontend-builder /app/web/dist /app/web/dist
RUN make bin

# RUN STAGE
FROM alpine:3.17

# Copy execute file
WORKDIR /app
COPY --from=backend-builder /app/hermes hermes

# Set execuateable
RUN chmod +x hermes

# Execute app
ENTRYPOINT ["./hermes"]