Skip to content

Commit

Permalink
Merge pull request #521 from webkom/build-fix
Browse files Browse the repository at this point in the history
Update to node 16 & fix some build errors
  • Loading branch information
LudvigHz authored Jan 16, 2023
2 parents 9125077 + 72fafa2 commit 11a5537
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 11 deletions.
12 changes: 6 additions & 6 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ name: default

steps:
- name: setup
image: node:14
image: node:16-alpine
when:
event:
- push
commands:
- yarn install --frozen-lockfile --ignore-scripts

- name: lint
image: node:14
image: node:16-alpine
when:
event:
- push
Expand All @@ -23,7 +23,7 @@ steps:
- yarn lint

- name: test
image: node:14
image: node:16-alpine
when:
event:
- push
Expand All @@ -33,7 +33,7 @@ steps:
- MONGO_URL=mongodb://mongodb:27017/vote-test REDIS_URL=redis yarn mocha

- name: coverage
image: node:14
image: node:16-alpine
when:
event:
- push
Expand All @@ -49,7 +49,7 @@ steps:
COVERALLS_SERVICE_NUMBER: ${DRONE_BUILD_NUMBER}

- name: build
image: node:14
image: node:16-alpine
when:
event:
- push
Expand Down Expand Up @@ -137,4 +137,4 @@ services:

---
kind: signature
hmac: 21eea9888fa631a87ec5a02ee2d6f8f5c2b41767ecbe7f9fe0ee4d66e03325c6
hmac: 1ec26cb4fae5d5b6f779d65ff5bd4dd4063ec3770e5527ef8c3447e0c700c9f8
18 changes: 15 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM node:14-slim
MAINTAINER Abakus Webkom <webkom@abakus.no>
FROM node:16-alpine as builder
LABEL org.opencontainers.image.authors="Abakus Webkom <webkom@abakus.no>"

# Create app directory
RUN mkdir -p /app
Expand All @@ -11,7 +11,19 @@ EXPOSE 3000
COPY . /app

# Build image
RUN yarn --production
RUN yarn --ignore-scripts
ENV NODE_ENV production
RUN yarn build

FROM node:16-alpine

WORKDIR /app

COPY --from=builder /app/bin bin
COPY --from=builder /app/public public
COPY --from=builder /app/dist dist
COPY --from=builder /app/package.json .
COPY --from=builder /app/node_modules node_modules

ARG RELEASE
ENV RELEASE ${RELEASE}
Expand Down
2 changes: 1 addition & 1 deletion app/digital/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ <h2>{{title}}</h2>
{{/if}}
{{#unless new}}
<hr/>
<p>Du har allerede motatt en bruker, og vi har registrert at du har klart å logge inn. Det vil si at du ikke vi få tilsendt en nytt brukernavn og passord. Ta kontakt med webkom dersom du mener dette er feil.
<p>Du har allerede motatt en bruker, og vi har registrert at du har klart å logge inn. Det vil si at du ikke vil få tilsendt et nytt brukernavn og passord. Ta kontakt med webkom dersom du mener dette er feil.
<hr/>
{{/unless}}
</center>
Expand Down
3 changes: 3 additions & 0 deletions app/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ export const handleError = (
status?: number
): Response => {
const statusCode = status || err.status || 500;
if (statusCode >= 500) {
console.error(err);
}
return res.status(statusCode).json(
err.payload || {
name: err.name,
Expand Down
5 changes: 5 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ declare module '*.yml' {
const data: any;
export default data;
}

declare module '*.html' {
const content: string;
export default content;
}
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const path = require('path');
module.exports = {
mode: 'none',
output: {
path: path.resolve(__dirname, '../', 'public'),
path: path.resolve(__dirname, 'dist', 'public'),
filename: '[name].js',
publicPath: '/static/',
},
Expand Down
1 change: 1 addition & 0 deletions webpack.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module.exports = {
patterns: [
{ from: 'app/views', to: 'app/views' },
{ from: 'public', to: 'public' },
{ from: 'app/digital/template.html', to: './template.html' },
],
}),
],
Expand Down

0 comments on commit 11a5537

Please sign in to comment.